private void Btn_ResetPass_Click(object sender, EventArgs e)
        {
            ChangePasswordForm changePasswordForm = new ChangePasswordForm();

            changePasswordForm.ChangePasswordOK += ChangePasswordForm_ChangePasswordOK;
            changePasswordForm.StartPosition     = FormStartPosition.CenterScreen;
            changePasswordForm.ShowDialog();
            changePasswordForm.Dispose();
        }
Beispiel #2
0
 private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (changepassForm == null || changepassForm.IsDisposed == true)
     {
         changepassForm           = new ChangePasswordForm();
         changepassForm.MdiParent = this;
         changepassForm.Show();
     }
 }
Beispiel #3
0
        public void ModifyPasswordResult()
        {
            MessageBox.Show("A jelszó módosítása sikeres!", "Információ", MessageBoxButtons.OK);

            if (ChangePasswordForm.hasInstance())
            {
                ChangePasswordForm.getCurrentInstance().Close();
            }
            ModelLocator.getInstance().SessionModel.NotifyOneOperationDone();
        }
        public ChangePasswordViewModel(ChangePasswordPage currentPage)
            : base(currentPage)
        {
            ChangePasswordForm = new ChangePasswordForm();

            var contactRepository  = new ContactRepository();
            var contactInformation = contactRepository.Get();

            Firstname = contactInformation.FirstName;
        }
Beispiel #5
0
        private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
        {
            ChangePasswordForm wind = new ChangePasswordForm();

            wind.G = this.G;
            if (wind.ShowDialog() == DialogResult.OK)
            {
                MessageAlert.Show("เปลี่ยนรหัสผ่านเรียบร้อย\nกรุณาออกจากระบบ และ ล็อกอินเข้าระบบใหม่อีกครั้ง", "Information", MessageAlertButtons.OK, MessageAlertIcons.INFORMATION);
            }
        }
Beispiel #6
0
        private void ChangePasswordMenuItem_Click(object sender, EventArgs e)
        {
            var securityService = IoC.Container.Get <ISecurityService>();

            CheckHelper.WithinCondition(securityService.IsLoggedIn, "securityService.IsLoggedIn");

            var form = new ChangePasswordForm();

            form.ShowDialog(this);
        }
        private void changePasswordButton_Click(object sender, EventArgs e)
        {
            ChangePasswordForm newForm = new ChangePasswordForm(pm);

            newForm.ShowDialog();

            pm = newForm.p;

            UpdateUserData();
        }
Beispiel #8
0
        private void changePasswordToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            if ((changePasswordForm == null) || (changePasswordForm.IsDisposed))
            {
                changePasswordForm = new ChangePasswordForm();

                changePasswordForm.MdiParent = this;
            }

            changePasswordForm.Show();
        }
        private void ChangePasswordToolStripMenuItem_Click(object sender, System.EventArgs e)
        {
            if (changePasswordForm == null || changePasswordForm.IsDisposed)
            {
                changePasswordForm = new ChangePasswordForm
                {
                    MdiParent = this,
                };
            }

            changePasswordForm.Show();
        }
Beispiel #10
0
        public async Task ResetPassword(ChangePasswordForm form)
        {
            var request = new RestRequest(Method.POST);

            request.Resource = "api/account/password/reset";
            request.AddJsonBody(form);
            var response = await Client.ExecuteTaskAsync(request);

            if (response.IsSuccessful)
            {
                return;
            }

            throw new ArgumentException("Something went wrong: " + response.Content);
        }
Beispiel #11
0
        public ActionResult ChangePassword(ChangePasswordForm form)
        {
            // prevent hackers!
            form.UserName = User.Identity.Name;

            _changePasswordFormValidator.Validate(form).Populate(ModelState);

            if (ModelState.IsValid)
            {
                _userService.ChangePassword(form.UserName, form.NewPassword);
                return(View("ChangePasswordSuccess"));
            }

            return(View(form));
        }
Beispiel #12
0
        private void UiBtn_UserManagement_Click(object sender, EventArgs e)
        {
            if (_User.TYPE == "Administrator")
            {
                UserManagementForm frm = new UserManagementForm();
                frm.ShowDialog();
            }
            else
            {
                ChangePasswordForm frm = new ChangePasswordForm(_User);
                frm.ShowDialog();

                _User = frm._User;
            }
        }
Beispiel #13
0
        private void ChangeLoginPasswordClick(object sender, EventArgs e)
        {
            ChangePasswordForm change = new ChangePasswordForm(OldModel, message);

            change.ShowDialog();
            if (change.PasswordChanged)
            {
                OldModel.Password = change.User.Password;
                OnSaveMethod(true);
                message.ShowInfo("Пароль успешно изменен");
            }
            else
            {
                return;
            }
        }
        void btnChangePassword_Click(object sender, RoutedEventArgs e)
        {
            try
            {
                Window parentWindow = Window.GetWindow(this);

                ChangePasswordForm frm = new ChangePasswordForm();
                frm.Owner = parentWindow;
                frm.Init(SelectedUser);
                frm.ShowDialog();
            }
            catch (Exception ex)
            {
                Utils.ShowErrorMessage(ex);
            }
        }
Beispiel #15
0
        private void ChangePassword(object sender, EventArgs e)
        {
            var changePassword = new ChangePasswordForm(CurrentUser.Username);
            var result         = changePassword.ShowDialog();

            if (result == DialogResult.OK)
            {
                CurrentUser = null;

                treeView.Visible               = false;
                loginMenuItem.Text             = "Đăng nhập";
                changePasswordMenuItem.Visible = false;
                toolStripSeparator3.Visible    = false;
                ShowLogin();
            }
        }
        private void ChangePasswordButton_Click(object sender, EventArgs e)
        {
            var form = new ChangePasswordForm {
                PasswordChanged = false
            };

            form.ShowDialog();
            if (form.PasswordChanged)
            {
                employee.Credentials.Password          = form.NewPassword;
                employee.Credentials.EncriptedPassword = employee.Credentials.EncryptPassword();
                PasswordTextBox.Text = form.NewPassword;
            }

            passwordChanged = form.PasswordChanged;
        }
        private void btnChangePassword_Click(object sender, EventArgs e)
        {
            ChangePasswordForm formChangePassword = new ChangePasswordForm();

            formChangePassword.ShowDialog();
            // 修改成功返回登录页面
            if (formChangePassword.m_isClosePage == true)
            {
                // 不询问直接退出到注册页面
                Program.m_MainForm.m_isInquiry = false;

                if (this.delegateCloseMainPage != null)
                {
                    this.delegateCloseMainPage(false);
                }
            }
        }
Beispiel #18
0
        public override void Run()
        {
//			var view = new ChangePasswordForm(UserSingleton.Instance);
//			view.SaveUser += delegate(User sender, EventArgs e) {
//				if (view.NewPassword != string.Empty) {
//					if (view.NewPassword == view.ConfirmPassword) {
//						sender.SaveOrUpdate();
//						view.Close();
//					} else {
//						MessageService.ShowWarning("Passwords do not match!");
//					}
//				} else {
//					sender.SaveOrUpdate();
//					view.Close();
//				}
//			};
//			WorkbenchSingleton.AddDialog(view);
            ChangePasswordForm form = new ChangePasswordForm(UserSingleton.Instance);

            WorkbenchSingleton.AddDialog(form);
        }
Beispiel #19
0
        public ActionResult ChangePassword(ChangePasswordForm form)
        {
            var user = _users.Query().SingleOrDefault(u => u.EmailAddress == User.Identity.Name);

            if (user == null)
            {
                throw new InvalidOperationException("Unable to find user...");
            }

            if (!user.IsThisTheUsersPassword(form.CurrentPassword))
            {
                ModelState.AddModelError("", "The current password is incorrect.");
                return(View());
            }

            user.SetPassword(form.NewPassword);
            _users.Save();

            this.Success("Your password has been changed.");

            return(this.RedirectToAction <DashboardController>(c => c.Index()));
        }
Beispiel #20
0
        public async Task <IActionResult> ChangePasswordAsync([FromBody] ChangePasswordForm changePasswordForm)
        {
            if (ModelState.IsValid)
            {
                var user = await _userManager.FindByEmailAsync(changePasswordForm.Email);

                Microsoft.AspNetCore.Identity.SignInResult signInResult = null;
                try
                {
                    signInResult = await _signInManager.PasswordSignInAsync(user.UserName,
                                                                            changePasswordForm.OldPassword, true, lockoutOnFailure : false);
                }
                catch
                {
                    return(BadRequest(new { errorMessage = "Username or password is not correct." }));
                }
                if (signInResult.IsLockedOut)
                {
                    return(BadRequest(new { errorMessage = "User account is locked." }));
                }
                if (signInResult.IsNotAllowed)
                {
                    return(BadRequest(new { errorMessage = "User account is not allowed." }));
                }
                if (signInResult.Succeeded)
                {
                    user.PasswordHash = _userManager.PasswordHasher.HashPassword(user, changePasswordForm.NewPassword);
                    var result = await _userManager.UpdateAsync(user);

                    if (!result.Succeeded)
                    {
                        return(BadRequest(new { errorMessage = "Change password has been failed" }));
                    }
                    return(Ok());
                }
            }
            return(BadRequest(new { errorMessage = "Please contact system administrator." }));
        }
Beispiel #21
0
        public IActionResult ChangePasswordByToken([FromBody] ChangePasswordForm changePasswordForm)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            var id = GetIdByToken(this);

            if (!_userService.UserExistsById(id))
            {
                return(NotFound(new Response("404", "User not found!")));
            }

            if (!_userService.CheckOldPassword(id, changePasswordForm.OldPassword))
            {
                return(BadRequest(new Response("400", "Old password not correct!")));
            }

            _userService.ChangePassword(id, changePasswordForm.NewPassword);

            return(Ok(new Response("200", "Successfully!")));
        }
Beispiel #22
0
        public async Task <IActionResult> ChangePassword(int id, [FromForm] ChangePasswordForm changePasswordForm)
        {
            string referer      = Request.Headers["Referer"].ToString();
            var    identity     = (ClaimsIdentity)User.Identity;
            int    userId       = Convert.ToInt32(identity.FindFirst(Models.User.UserId).Value);
            User   loggedInUser = await _context.Users.FindAsync(userId);

            if (changePasswordForm.CurrentPassword == null || changePasswordForm.NewPassword == null || changePasswordForm.RepeatNewPassword == null)
            {
                return(View("Edit", loggedInUser));
            }

            bool passwordMatches = BCrypt.Net.BCrypt.Verify(changePasswordForm.CurrentPassword, loggedInUser.Password);

            if (!passwordMatches)
            {
                ViewData.Add("error", "Felaktigt lösenord!");
                return(View("Edit", loggedInUser));
            }

            if (!changePasswordForm.NewPassword.Equals(changePasswordForm.RepeatNewPassword))
            {
                ViewData.Add("error", "Lösenorden matchar inte!");
                return(View("Edit", loggedInUser));
            }

            string hashedPassword = BCrypt.Net.BCrypt.HashPassword(changePasswordForm.NewPassword);

            loggedInUser.Password = hashedPassword;

            _context.Update(loggedInUser);
            await _context.SaveChangesAsync();

            ViewData.Add("success", "Lösenordet är nu ändrat!");
            return(View("Edit", loggedInUser));
        }
Beispiel #23
0
        private void ChangePass_btn_Click(object sender, EventArgs e)
        {
            ChangePasswordForm cpfrm = new ChangePasswordForm();

            cpfrm.ShowDialog();
        }
Beispiel #24
0
 /// <summary>
 /// Opens menu for changing the users password
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void changePasswordToolStripMenuItem_Click(object sender, EventArgs e)
 {
     if (cpf == null)
     {
         cpf = new ChangePasswordForm();
         cpf.MdiParent = this;
         cpf.FormClosed += new FormClosedEventHandler(cpf_FormClosed);
         cpf.Show();
     }
     else
     {
         cpf.Activate();
     }
 }
Beispiel #25
0
 public EditAccountViewModel()
 {
     this.Account            = new DeveloperAccountDTO();
     this.ChangePasswordForm = new ChangePasswordForm();
 }
Beispiel #26
0
 public EditAccountViewModel(DeveloperAccountDTO account)
 {
     this.Account            = account;
     this.ChangePasswordForm = new ChangePasswordForm();
 }
Beispiel #27
0
 /// <summary>
 /// Helper form so that above form only has one instance at a time.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 void cpf_FormClosed(object sender, FormClosedEventArgs e)
 {
     cpf = null;
     //throw new NotImplementedException();
 }
Beispiel #28
0
        private void 更改密码ToolStripMenuItem_Click(object sender, EventArgs e)
        {
            var cf = new ChangePasswordForm();

            cf.ShowDialog();
        }
Beispiel #29
0
        /// <summary>
        /// show dialog for change password for diagram</summary>
        public string changePassword(String currentPassword)
        {
            string password = null;

            if (this.changePasswordForm == null)
            {
                this.changePasswordForm = new ChangePasswordForm(this);
            }

            this.changePasswordForm.Clear();
            this.changePasswordForm.oldpassword = currentPassword;
            this.changePasswordForm.ShowDialog();
            if (!this.changePasswordForm.cancled)
            {
                password = this.changePasswordForm.GetPassword();
                this.changePasswordForm.Clear();
            }

            this.changePasswordForm = null;

            return password;
        }
 //
 // GET: /Account/Manage/ChangePassword
 public ActionResult ChangePassword()
 {
     ViewData["Form"] = new ChangePasswordForm().Init(null, User);
     return(View());
 }
Beispiel #31
0
        public ActionResult ChangePassword()
        {
            var form = new ChangePasswordForm();

            return(View(form));
        }
Beispiel #32
0
        private void lblChangePassword_Click(object sender, EventArgs e)
        {
            ChangePasswordForm passForm = new ChangePasswordForm(user);

            passForm.Visible = true;
        }
Beispiel #33
0
        private void ShowChangePassword(object sender, ItemClickEventArgs e)
        {
            var changeForm = new ChangePasswordForm();

            BaseControl.OpenForm(changeForm);
        }