добавляет смену пароля
This commit is contained in:
parent
c412738640
commit
121abac88e
@ -91,13 +91,28 @@ namespace AwesomeEmailExtractor
|
||||
{
|
||||
SqliteCommand command = new SqliteCommand();
|
||||
command.Connection = Globals.db;
|
||||
command.CommandText = "DELETE FROM users WHERE id = @id";
|
||||
command.CommandText = "DELETE FROM users WHERE id = @id;";
|
||||
|
||||
SqliteParameter loginParam = new SqliteParameter("@id", ID);
|
||||
command.Parameters.Add(loginParam);
|
||||
SqliteParameter idParam = new SqliteParameter("@id", ID);
|
||||
command.Parameters.Add(idParam);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
|
||||
public void ChangePassword(string password)
|
||||
{
|
||||
SqliteCommand command = new SqliteCommand();
|
||||
command.Connection = Globals.db;
|
||||
command.CommandText = "UPDATE users SET password = @password WHERE id = @id;";
|
||||
|
||||
SqliteParameter idParam = new SqliteParameter("@id", ID);
|
||||
command.Parameters.Add(idParam);
|
||||
|
||||
SqliteParameter passwordParam = new SqliteParameter("@password", Authorization.EncryptPassword(password));
|
||||
command.Parameters.Add(passwordParam);
|
||||
|
||||
command.ExecuteNonQuery();
|
||||
}
|
||||
}
|
||||
|
||||
public class AdminUtils
|
||||
|
1
SettingsForm.Designer.cs
generated
1
SettingsForm.Designer.cs
generated
@ -44,6 +44,7 @@
|
||||
this.changePasswordButton.TabIndex = 0;
|
||||
this.changePasswordButton.Text = "Изменить пароль";
|
||||
this.changePasswordButton.UseVisualStyleBackColor = true;
|
||||
this.changePasswordButton.Click += new System.EventHandler(this.changePasswordButton_Click);
|
||||
//
|
||||
// entryNewPassword
|
||||
//
|
||||
|
@ -24,7 +24,7 @@ namespace AwesomeEmailExtractor
|
||||
if (result == DialogResult.Yes)
|
||||
{
|
||||
Globals.currentUser.Delete();
|
||||
MessageBox.Show("Аккаунт удален");
|
||||
MessageBox.Show("Аккаунт удален!");
|
||||
|
||||
this.Close();
|
||||
|
||||
@ -32,5 +32,17 @@ namespace AwesomeEmailExtractor
|
||||
FormManager.Current.Navigate(this.Owner, authorization);
|
||||
}
|
||||
}
|
||||
|
||||
private void changePasswordButton_Click(object sender, EventArgs e)
|
||||
{
|
||||
if (!string.Equals(entryNewPassword.Text, entryRePassword.Text))
|
||||
{
|
||||
MessageBox.Show("Пароли не совпадают!");
|
||||
return;
|
||||
}
|
||||
|
||||
Globals.currentUser.ChangePassword(entryNewPassword.Text);
|
||||
MessageBox.Show("Пароль изменен!");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user