добавляет сообщения DeleteAccount и ChangePassword
This commit is contained in:
parent
16b0c72c5d
commit
8f85c25a62
@ -66,10 +66,7 @@ namespace AwesomeEmailExtractor
|
|||||||
command.CommandText = "CREATE TABLE IF NOT EXISTS logs_actions (id INTEGER PRIMARY KEY, name TEXT NOT NULL)";
|
command.CommandText = "CREATE TABLE IF NOT EXISTS logs_actions (id INTEGER PRIMARY KEY, name TEXT NOT NULL)";
|
||||||
command.ExecuteNonQuery();
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
command.CommandText = "INSERT OR IGNORE INTO logs_actions (id, name) VALUES (0, 'Выполнение'), (1, 'Вход'), (2, 'Регистрация');";
|
command.CommandText = "CREATE TABLE IF NOT EXISTS logs (id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, date TEXT NOT NULL, action INTEGER NOT NULL, message TEXT NOT NULL);";
|
||||||
command.ExecuteNonQuery();
|
|
||||||
|
|
||||||
command.CommandText = "CREATE TABLE IF NOT EXISTS logs (id INTEGER PRIMARY KEY AUTOINCREMENT, user_id INTEGER NOT NULL, date TEXT NOT NULL, action INTEGER NOT NULL, message TEXT NOT NULL, FOREIGN KEY(action) REFERENCES logs_actions(id));";
|
|
||||||
command.ExecuteNonQuery();
|
command.ExecuteNonQuery();
|
||||||
|
|
||||||
command.CommandText = "ATTACH DATABASE @dbpath AS appDB";
|
command.CommandText = "ATTACH DATABASE @dbpath AS appDB";
|
||||||
|
12
Logs.cs
12
Logs.cs
@ -33,7 +33,9 @@ namespace AwesomeEmailExtractor
|
|||||||
{
|
{
|
||||||
Execute,
|
Execute,
|
||||||
Login,
|
Login,
|
||||||
Registration
|
Registration,
|
||||||
|
DeleteAccount,
|
||||||
|
ChangePassword
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Log(User user, Action action, Dictionary<string, object> options)
|
public static void Log(User user, Action action, Dictionary<string, object> options)
|
||||||
@ -151,6 +153,14 @@ namespace AwesomeEmailExtractor
|
|||||||
{
|
{
|
||||||
return "Пользователь зарегистрировался в системе.";
|
return "Пользователь зарегистрировался в системе.";
|
||||||
}
|
}
|
||||||
|
if (action == Action.DeleteAccount)
|
||||||
|
{
|
||||||
|
return "Пользователь удалил аккаунт из системы.";
|
||||||
|
}
|
||||||
|
if (action == Action.ChangePassword)
|
||||||
|
{
|
||||||
|
return "Пользователь сменил пароль.";
|
||||||
|
}
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -24,6 +24,7 @@ namespace AwesomeEmailExtractor
|
|||||||
if (result == DialogResult.Yes)
|
if (result == DialogResult.Yes)
|
||||||
{
|
{
|
||||||
Globals.currentUser.Delete();
|
Globals.currentUser.Delete();
|
||||||
|
Logs.Log(Globals.currentUser, Logs.Action.DeleteAccount, new Dictionary<string, object>());
|
||||||
MessageBox.Show("Аккаунт удален!");
|
MessageBox.Show("Аккаунт удален!");
|
||||||
|
|
||||||
this.Close();
|
this.Close();
|
||||||
@ -42,6 +43,7 @@ namespace AwesomeEmailExtractor
|
|||||||
}
|
}
|
||||||
|
|
||||||
Globals.currentUser.ChangePassword(entryNewPassword.Text);
|
Globals.currentUser.ChangePassword(entryNewPassword.Text);
|
||||||
|
Logs.Log(Globals.currentUser, Logs.Action.ChangePassword, new Dictionary<string, object>());
|
||||||
MessageBox.Show("Пароль изменен!");
|
MessageBox.Show("Пароль изменен!");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user