Exemplo n.º 1
0
        public static void Password_change(string new_password, string current_password, string confirmationpassword, My_Account account)
        {
            PasswordChangeReciever       info = new PasswordChangeReciever(new_password, current_password, confirmationpassword, account);
            PasswordStringsFilledHandler stringsFilledHandler = new PasswordStringsFilledHandler();
            PasswordValidationHandler    validationHandler    = new PasswordValidationHandler();
            PasswordConfirmationHandler  confirmationHandler  = new PasswordConfirmationHandler();
            ChangePasswordHandler        passwordHandler      = new ChangePasswordHandler();

            stringsFilledHandler.Successor = validationHandler;
            validationHandler.Successor    = confirmationHandler;
            confirmationHandler.Successor  = passwordHandler;
            stringsFilledHandler.Handle(info);
        }
 public override void Handle(PasswordChangeReciever reciever)
 {
     if (reciever.NewPassword != reciever.ConfimationPassword)
     {
         TextBlock dialogContent = new TextBlock();
         dialogContent.Text = "Значения в полях нового пароля и подтверждения пароля не совпадают";
         ShowDial(reciever.Account, dialogContent);
     }
     else if (Successor != null)
     {
         Successor.Handle(reciever);
     }
 }
Exemplo n.º 3
0
 public override void Handle(PasswordChangeReciever reciever)
 {
     if (string.IsNullOrWhiteSpace(reciever.NewPassword) || string.IsNullOrEmpty(reciever.NewPassword) || string.IsNullOrWhiteSpace(reciever.CurrentPassword) || string.IsNullOrEmpty(reciever.CurrentPassword) || string.IsNullOrWhiteSpace(reciever.ConfimationPassword) || string.IsNullOrEmpty(reciever.ConfimationPassword))
     {
         TextBlock dialogContent = new TextBlock();
         dialogContent.Text = "Заполните все необходимые поля";
         ShowDial(reciever.Account, dialogContent);
     }
     else if (Successor != null)
     {
         Successor.Handle(reciever);
     }
 }
        public override void Handle(PasswordChangeReciever reciever)
        {
            DataContext db           = new DataContext(DB_connection.connectionString);
            TUsers      user         = db.GetTable <TUsers>().Where(k => k.Id == User.CurrentUser.ID).First();
            string      RealPassword = user.Password;

            if (reciever.CurrentPassword != RealPassword)
            {
                TextBlock dialogContent = new TextBlock();
                dialogContent.Text = "Указано неправильное значение старого пароля";
                ShowDial(reciever.Account, dialogContent);
            }
            else if (Successor != null)
            {
                Successor.Handle(reciever);
            }
        }
Exemplo n.º 5
0
        public override void Handle(PasswordChangeReciever reciever)
        {
            TextBlock dialogContent = new TextBlock();
            TUsers    user          = db.GetTable <TUsers>().Where(k => k.Id == User.CurrentUser.ID).First();

            user.Password = reciever.NewPassword;
            try
            {
                db.SubmitChanges();
            }
            catch (Exception e)
            {
                dialogContent.Text = e.Message;
                ShowDial(reciever.Account, dialogContent);
            }
            dialogContent.Text = "Изменения были успешно внесены";
            ShowDial(reciever.Account, dialogContent);
        }
Exemplo n.º 6
0
 public abstract void Handle(PasswordChangeReciever receiver);