protected void changeBtn_Click(object sender, EventArgs e) { bool stat = true; string oldPass = oldPswdBox.Text; string newPass = newPswdBox.Text; string confPass = confPswdBox.Text; if (!ChangePasswordController.isBoxFilled(oldPass)) { oldPswdValidator.Text = "Old password must be filled!"; stat = false; } if (!ChangePasswordController.isBoxFilled(newPass)) { newPswdBoxValidator.Text = "New Password must be filled!"; stat = false; } if (!ChangePasswordController.isBoxFilled(confPass)) { confPswdBoxValidator.Text = "Confirmation password must be filled!"; stat = false; } if (ChangePasswordController.oldPasswordMatch(oldPass) && stat) { if (!ChangePasswordController.updatePassword(newPass, confPass)) { warningLbl.Text = "Confirmation password is not same with new password!"; } else { Response.Redirect("./ViewProfile.aspx"); } } }
protected override void OnActivated() { resetController = Frame.GetController<ResetPasswordController>(); changeController = Frame.GetController<ChangePasswordController>(); if (changeController.Actions.Count != 0) { ((PopupWindowShowAction)changeController.Actions.FirstOrDefault(a => a.Id == "ChangePasswordByUser")).Executed += (object sender, ActionBaseEventArgs args) => { // DevExpress.XtraEditors.XtraMessageBox.Show(""); }; } ((PopupWindowShowAction)resetController.Actions.FirstOrDefault(a => a.Id == "ResetPassword")).Executed += (object sender, ActionBaseEventArgs args) => { //DevExpress.XtraEditors.XtraMessageBox.Show(""); if (((Employee)((PopupWindowShowActionExecuteEventArgs)args).CurrentObject).UserName == SecuritySystem.CurrentUserName) { if (File.Exists(AppDomain.CurrentDomain.BaseDirectory + "LoginOptions") && new FileInfo(AppDomain.CurrentDomain.BaseDirectory + "LoginOptions").Length != 0) { File.Delete(AppDomain.CurrentDomain.BaseDirectory + "LoginOptions"); //using (System.IO.StreamWriter file = new System.IO.StreamWriter("LoginOptions")) //{ //} } } }; base.OnActivated(); }
public void SetUp() { userService = A.Fake <IUserService>(); passwordService = A.Fake <IPasswordService>(); authenticatedController = new ChangePasswordController(passwordService, userService) .WithDefaultContext() .WithMockUser(true, adminId: LoggedInAdminId, delegateId: LoggedInDelegateId); }
protected Boolean DataValidation(string oldPass, string newPass, string confirmPass) { data = (Model.User)Session["user"]; string errorMessage = ""; Boolean isSuccess = ChangePasswordController.DataValidationController(oldPass, newPass, confirmPass, data, out errorMessage); LblError.Text = errorMessage; return(isSuccess); }
public void ChangePassword_ChangePassword_ReturnsActionName() { ChangePasswordController controller = new ChangePasswordController(true); RedirectToActionResult result = (RedirectToActionResult)controller.ChangePassword(new ChangePassword() { UserName = "******", NewPassword = "******" }); ViewResult result2 = (ViewResult)controller.ChangePassword(new NetCoreUserInterface.Models.ChangePassword() { }); Assert.AreEqual("Todos", result.ActionName); Assert.AreEqual("ChangePassword", result2.ViewName); }
protected void BtnUpdate_Click(object sender, EventArgs e) { string oldPassword = TxtOldPassword.Text.ToString(); string newPassword = TxtNewPassword.Text.ToString(); string confirmPass = TxtConfirmPassword.Text.ToString(); Boolean isFormatCorrect = DataValidation(oldPassword, newPassword, confirmPass); if (isFormatCorrect == true) { int id = Int32.Parse(data.Id.ToString()); ChangePasswordController.UpdateUserPasswordController(id, newPassword); Response.Redirect("Profile.aspx"); } }
public async Task WhenBodyCalled_ReturnHtml() { var controller = new ChangePasswordController(_compositeSettings, _authService, _documentService, _config); controller.ControllerContext = new ControllerContext { HttpContext = new DefaultHttpContext() }; var result = await controller.Body() as ViewResult; result.Should().NotBeNull(); result.Should().BeOfType <ViewResult>(); result.ViewName.Should().BeNull(); }
protected void changepassBtn_Click(object sender, EventArgs e) { User us = (User)Session["user"]; string oldpass = OldPassTextBox.Text.ToString(); string newpass = NewPassTextBox.Text.ToString(); string confpass = ConfirmPassTextBox.Text.ToString(); string errorMsg = ""; bool success = ChangePasswordController.validatePassword(us.UserID, oldpass, newpass, confpass, out errorMsg); if (!success) { labelError.Visible = true; labelError.Text = errorMsg; } else { Response.Redirect("ViewProfile.aspx"); } }
// Event Handlers // Confirm Button Event Handler private void ButtonConfirm_Click(object sender, EventArgs e) { // Validate the passwords ChangePasswordController changePasswordController = new ChangePasswordController(_employee); try { changePasswordController.ValidatePassword(textBoxOldPassword.Text, textBoxNewPassword.Text, textBoxReconfrimPassword.Text); changePasswordController.ChangePassword(); if (_isFirstLogin) { changePasswordController.ActivateAccount(); } _isPasswordChanged = true; this.Close(); } catch (InvalidChangePasswordException exception) { exception.ShowErrorMessage(); } }
public void ChangePassword() { try { var controller = new ChangePasswordController(); IHttpActionResult result = controller.PostChangePasswordUpdate(new ChangePasswordModel() { CurrentPassword = "******", EMPPassword = "******", Id = new Guid("85b2b509-303b-4880-9e7b-074eabd6178c") }); var contentResult = result as OkNegotiatedContentResult <bool>; if (contentResult == null) { Assert.Fail(); } Assert.AreEqual(contentResult.Content, true); } catch (Exception e) { Assert.Fail(string.Format("Unexpected exception of type {0} caught: {1}", e.GetType(), e.Message)); } }
public static ChangePasswordController Fixture() { ChangePasswordController controller = new ChangePasswordController(new ChangePasswordRepository(), "", new LoginView()); return controller; }
public static ChangePasswordController Fixture() { ChangePasswordController controller = new ChangePasswordController(new ChangePasswordRepository(), "", new LoginView()); return(controller); }
public void setChangePasswordController(ChangePasswordController _changePasswordController) { changePasswordController = _changePasswordController; }