Example #1
0
        public void User_Password_Reset_Password_And_Send_Message()
        {
            BusinessPrincipal.Login();

            var user     = UserService.UserNew();
            var name     = DataHelper.RandomString(20);
            var password = DataHelper.RandomString(20);

            user.Name      = name;
            user.FirstName = DataHelper.RandomString(20);
            user.LastName  = DataHelper.RandomString(20);
            user.Email     = DataHelper.RandomEmail();
            user.Role      = Role.FullControl;

            user.SetPassword(password);

            user = UserService.UserSave(user, new EmptyMessenger());

            UserService.UserFetch(user.UserId);

            BusinessPrincipal.Login(name, password);

            BusinessPrincipal.Logout();

            string newPassword;

            UserPasswordService.UserPasswordReset(name, out newPassword, MessengerHelper.InitMessengerForUserUpdatePassword());

            BusinessPrincipal.Login(name, newPassword);

            BusinessPrincipal.Logout();
        }
Example #2
0
        public ActionResult ForgotPassword(ForgotPasswordModel model)
        {
            if (this.ModelState.IsValid)
            {
                UserPasswordService.UserPasswordReset(model.Name);

                return(this.RedirectToAction("LogOff"));
            }

            return(this.View(model));
        }