Ejemplo n.º 1
0
        public ActionResult PasswordResetFinalStep(Guid token, string pincode)
        {
            var result = VerifyPincode(token, pincode);

            if (result != null)
            {
                return(result);
            }

            var tokenEntity = ScpContext.Services.Organizations.GetPasswordresetAccessToken(token);
            var account     = ScpContext.Services.Organizations.GetUserGeneralSettings(tokenEntity.ItemId,
                                                                                       tokenEntity.AccountId);

            var model = new PasswordResetFinalStepModel();

            model.PasswordEditor.Settings = ScpContext.Services.Organizations.GetOrganizationPasswordSettings(tokenEntity.ItemId);
            model.Login = account.UserPrincipalName;

            return(View(model));
        }
Ejemplo n.º 2
0
        public ActionResult PasswordResetFinalStep(Guid token, string pincode, PasswordResetFinalStepModel model)
        {
            if (!ModelState.IsValid)
            {
                return(View(model));
            }

            var result = VerifyPincode(token, pincode);

            if (result != null)
            {
                return(result);
            }

            var tokenEntity = ScpContext.Services.Organizations.GetPasswordresetAccessToken(token);

            ScpContext.Services.Organizations.SetUserPassword(
                tokenEntity.ItemId, tokenEntity.AccountId,
                model.PasswordEditor.NewPassword);

            ScpContext.Services.Organizations.DeletePasswordresetAccessToken(token);

            return(RedirectToRoute(AccountRouteNames.PasswordResetSuccess));
        }