private void button2_Click(object sender, EventArgs e)
        {
            ChangePasswordEventArgs changePasswordevent = new ChangePasswordEventArgs();

            changePasswordevent.Event(sender, e, null);
            this.Close();
        }
        private void authService_ChangePassword(object sender, ChangePasswordEventArgs e)
        {
            var authService = (SshAuthenticationService)sender;

            e.Result = PasswordChangeResult.Failure;

            // Write to event log.
            string resultText = "";

            switch (e.Result)
            {
            case PasswordChangeResult.Success:
                resultText = "succeeded";
                break;

            case PasswordChangeResult.FurtherAuthRequired:
                resultText = "succeeded but further authentication is required";
                break;

            case PasswordChangeResult.Failure:
                resultText = "failed";
                break;

            case PasswordChangeResult.NewPasswordUnacceptable:
                resultText = "failed because the new password is unacceptable";
                break;
            }

            LogClientEvent(authService.Client, string.Format("Password change {0}.", resultText),
                           EventLogEntryType.Information);
        }
        private void RaisePasswordChangedEvent(ChangePasswordModel model)
        {
            var handler = PasswordChanged;

            if (handler != null)
            {
                ChangePasswordEventArgs e = new ChangePasswordEventArgs(model);
                handler(this, e);
            }
        }
        public void SetPropertiesCorrectly()
        {
            var current = "*****@*****.**";
            var newPass = "******";
            var userId  = "897sad89&D*(&AS*(D7a(S*Dasdjkasdhasjkhasdk";

            var args = new ChangePasswordEventArgs(current, newPass, userId);

            Assert.AreSame(current, args.CurrentPassword);
            Assert.AreSame(newPass, args.NewPassword);
            Assert.AreEqual(userId, args.UserId);
        }
Beispiel #5
0
 public bool OnChangingpassword(object sender, ChangePasswordEventArgs e)
 {
     foreach (User user in users)
     {
         if (user.Username == e.Usertext)
         {
             if (user.Password == e.Passwordtext)
             {
                 user.Password = e.NewPasswordtext;
                 SerializeData();
                 return(true);
             }
         }
     }
     SerializeData();
     return(false);
 }