Пример #1
0
        public ActionResult ResetPassword(string i, string t)
        {
            var user = _userContextService.GetCurrentContext();

            if (user.IsCofoundryUser())
            {
                return(GetLoggedInDefaultRedirectAction());
            }

            var request = _authenticationHelper.IsPasswordRequestValid(this, i, t, new CofoundryAdminUserArea());

            if (!request.IsValid)
            {
                return(View("ResetPasswordRequestInvalid", request));
            }

            var vm = new CompletePasswordResetViewModel();

            vm.UserPasswordResetRequestId = i;
            vm.Token = t;

            var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword));

            return(View(viewPath, vm));
        }
Пример #2
0
        public async Task <ActionResult> ResetPassword(CompletePasswordResetViewModel vm)
        {
            var user = await _userContextService.GetCurrentContextAsync();

            if (user.IsCofoundryUser())
            {
                return(await GetLoggedInDefaultRedirectActionAsync());
            }

            var template = new PasswordChangedTemplate();
            var settings = await _queryExecutor.ExecuteAsync(new GetSettingsQuery <GeneralSiteSettings>());

            template.ApplicationName = settings.ApplicationName;

            await _authenticationHelper.CompletePasswordResetAsync(this, vm, template, _adminUserArea);

            if (ModelState.IsValid)
            {
                var completeViewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword) + "Complete");
                return(View(completeViewPath));
            }

            var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword));

            return(View(viewPath, vm));
        }
Пример #3
0
        public async Task <ActionResult> ResetPassword(string i, string t)
        {
            var user = await _userContextService.GetCurrentContextAsync();

            if (user.IsCofoundryUser())
            {
                return(await GetLoggedInDefaultRedirectActionAsync());
            }

            var request = await _authenticationHelper.IsPasswordRequestValidAsync(this, i, t, _adminUserArea);

            if (!request.IsValid)
            {
                var invalidViewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword) + "RequestInvalid");
                return(View(invalidViewPath, request));
            }

            var vm = new CompletePasswordResetViewModel();

            vm.UserPasswordResetRequestId = i;
            vm.Token = t;

            var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword));

            return(View(viewPath, vm));
        }
Пример #4
0
        public ActionResult ResetPassword(CompletePasswordResetViewModel vm)
        {
            var user = _userContextService.GetCurrentContext();

            if (user.IsCofoundryUser())
            {
                return(GetLoggedInDefaultRedirectAction());
            }

            _authenticationHelper.CompletePasswordReset(this, vm, new PasswordChangedTemplate(), new CofoundryAdminUserArea());

            return(Redirect(AuthRouteLibrary.Urls.Login()));
        }
Пример #5
0
        public ActionResult ResetPassword(string i, string t)
        {
            var request = _authenticationHelper.IsPasswordRequestValid(this, i, t, new CofoundryAdminUserArea());

            if (!request.IsValid)
            {
                return(View("ResetPasswordRequestInvalid", request));
            }

            var vm = new CompletePasswordResetViewModel();

            vm.UserPasswordResetRequestId = i;
            vm.Token = t;

            var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword));

            return(View(viewPath, vm));
        }
Пример #6
0
        public async Task <ActionResult> ResetPassword(CompletePasswordResetViewModel vm)
        {
            var user = await _userContextService.GetCurrentContextAsync();

            if (user.IsCofoundryUser())
            {
                return(await GetLoggedInDefaultRedirectActionAsync());
            }

            await _authenticationHelper.CompletePasswordResetAsync(this, vm, new PasswordChangedTemplate(), USER_AREA);

            if (ModelState.IsValid)
            {
                var completeViewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword) + "Complete");
                return(View(completeViewPath));
            }

            var viewPath = ViewPathFormatter.View(CONTROLLER_NAME, nameof(ResetPassword));

            return(View(viewPath, vm));
        }