예제 #1
0
        public async Task SaveAsync()
        {
            var hashedNewPassword    = NewPassword.HashValue();
            var hashedRepeatPassword = RepeatPassword.HashValue();

            if (!hashedNewPassword.Equals(hashedRepeatPassword))
            {
                IMainWindowViewModel.MessageQueue.Enqueue("The new password don't much with the repeated one.",
                                                          "OK",
                                                          (obj) => { },
                                                          new object(),
                                                          false,
                                                          true,
                                                          TimeSpan.FromSeconds(6));

                return;
            }

            var result = await IMainWindowViewModel.User.TryChangePasswordAsync(IMainWindowViewModel.User.Email, CurrentPassword, hashedNewPassword);

            if (result)
            {
                IMainWindowViewModel.MessageQueue.Enqueue("Password has changed successfully.",
                                                          "OK",
                                                          (obj) => { },
                                                          new object(),
                                                          false,
                                                          true,
                                                          TimeSpan.FromSeconds(6));
            }
            else
            {
                IMainWindowViewModel.MessageQueue.Enqueue("The old password do not much to one of the records in the server.",
                                                          "OK",
                                                          (obj) => { },
                                                          new object(),
                                                          false,
                                                          true,
                                                          TimeSpan.FromSeconds(6));
            }

            CurrentPassword.Clear();
            NewPassword.Clear();
            RepeatPassword.Clear();
        }
예제 #2
0
 private void ResetButton_Click1(object sender, RoutedEventArgs e)
 {
     CurrentPassword.Clear();
     NewPassword1.Clear();
     NewPassword2.Clear();
 }