Exemplo n.º 1
0
        private void ProcessPasswordResetRequest(UserModel user)
        {
            PasswordResetController passwordResetController = new PasswordResetController();

            PasswordResetModel passwordResetModel = new PasswordResetModel();

            passwordResetModel.PasswordResetKey = Guid.NewGuid();
            passwordResetModel.UserId           = user.Id;
            passwordResetModel.Completed        = false;

            passwordResetModel.Id = passwordResetController.SavePasswordReset(passwordResetModel);

            Mailer.MailUserPasswordResetRequest(passwordResetModel, user);
        }
Exemplo n.º 2
0
        private void ProcessPasswordReset()
        {
            if (ViewState["ResetId"].ToString() != "")
            {
                PasswordResetController controller = new PasswordResetController();

                PasswordResetModel passwordResetModel = controller.LoadPasswordResetByKey(new Guid(ViewState["ResetId"].ToString()));

                if (passwordResetModel != null && passwordResetModel.Completed == false)
                {
                    UserController userController = new UserController();

                    UserModel userModel = userController.LoadUser(passwordResetModel.UserId.ToString());

                    userModel.CreateOrReset = true;

                    userModel.Password = ReEnterPasswordTextBox.Text;

                    userController.SaveUser(userModel);

                    passwordResetModel.Completed = true;

                    controller.SavePasswordReset(passwordResetModel);

                    Logger.CreateLog("Password reset done for user " + userModel.UserName, 1);

                    PasswordResetLabel.Text =
                        "Password reset.  Please click <a href='Default.aspx'>here</a> to login.";
                    ResetPasswordPanel.Visible = false;
                }
                else
                {
                    PasswordResetLabel.Text =
                        "Password reset code already used.  Please create a <a href='RetrievePassword.aspx'>new</a> reset request.";
                    ResetPasswordPanel.Visible = false;
                }
            }
        }