2022-05-22 10:56:32 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Data;
|
|
|
|
|
using System.Drawing;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows.Forms;
|
|
|
|
|
|
|
|
|
|
namespace AwesomeEmailExtractor
|
|
|
|
|
{
|
|
|
|
|
public partial class SettingsForm : Form
|
|
|
|
|
{
|
|
|
|
|
public SettingsForm()
|
|
|
|
|
{
|
|
|
|
|
InitializeComponent();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void deleteAccountButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2022-05-24 15:25:44 +03:00
|
|
|
|
DialogResult result = MessageBox.Show("Вы уверены что хотите удалить аккаунт?", "Удаление аккаунта", MessageBoxButtons.YesNo, MessageBoxIcon.Warning);
|
2022-05-22 10:56:32 +03:00
|
|
|
|
|
|
|
|
|
if (result == DialogResult.Yes)
|
|
|
|
|
{
|
|
|
|
|
Globals.currentUser.Delete();
|
2022-05-24 13:01:28 +03:00
|
|
|
|
Logs.Log(Globals.currentUser, Logs.Action.DeleteAccount, new Dictionary<string, object>());
|
2022-05-24 15:25:44 +03:00
|
|
|
|
MessageBox.Show("Аккаунт удален!", "Аккаунт удален", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2022-05-22 10:56:32 +03:00
|
|
|
|
|
|
|
|
|
this.Close();
|
|
|
|
|
|
|
|
|
|
AuthorizationForm authorization = FormManager.Current.CreateForm<AuthorizationForm>();
|
|
|
|
|
FormManager.Current.Navigate(this.Owner, authorization);
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-05-22 11:08:55 +03:00
|
|
|
|
|
|
|
|
|
private void changePasswordButton_Click(object sender, EventArgs e)
|
|
|
|
|
{
|
2022-05-24 13:49:52 +03:00
|
|
|
|
if (string.IsNullOrEmpty(entryNewPassword.Text))
|
|
|
|
|
{
|
2022-05-24 15:25:44 +03:00
|
|
|
|
MessageBox.Show("Введите пароль!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2022-05-24 13:49:52 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
2022-05-22 11:08:55 +03:00
|
|
|
|
if (!string.Equals(entryNewPassword.Text, entryRePassword.Text))
|
|
|
|
|
{
|
2022-05-24 15:25:44 +03:00
|
|
|
|
MessageBox.Show("Пароли не совпадают!", "Ошибка", MessageBoxButtons.OK, MessageBoxIcon.Error);
|
2022-05-22 11:08:55 +03:00
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Globals.currentUser.ChangePassword(entryNewPassword.Text);
|
2022-05-24 13:01:28 +03:00
|
|
|
|
Logs.Log(Globals.currentUser, Logs.Action.ChangePassword, new Dictionary<string, object>());
|
2022-05-24 15:25:44 +03:00
|
|
|
|
MessageBox.Show("Пароль изменен!", "Пароль изменен", MessageBoxButtons.OK, MessageBoxIcon.Information);
|
2022-05-22 11:08:55 +03:00
|
|
|
|
}
|
2022-05-22 10:56:32 +03:00
|
|
|
|
}
|
|
|
|
|
}
|