mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-11-24 16:53:10 +08:00
Actually signout user on change password. (#8478)
This is controlled by the existing setting that would invalidate all extant auth cookies on change password.
This commit is contained in:
committed by
GitHub
parent
d2d77f78eb
commit
10963275c3
@@ -1,4 +1,4 @@
|
||||
using System;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Text.RegularExpressions;
|
||||
@@ -257,15 +257,25 @@ namespace Orchard.Users.Controllers {
|
||||
ViewData["UppercaseRequirement"] = membershipSettings.GetPasswordUppercaseRequirement();
|
||||
ViewData["SpecialCharacterRequirement"] = membershipSettings.GetPasswordSpecialRequirement();
|
||||
ViewData["NumberRequirement"] = membershipSettings.GetPasswordNumberRequirement();
|
||||
ViewData["InvalidateOnPasswordChange"] = _orchardServices.WorkContext
|
||||
var shouldSignout = _orchardServices.WorkContext
|
||||
.CurrentSite.As<SecuritySettingsPart>()
|
||||
.ShouldInvalidateAuthOnPasswordChanged;
|
||||
ViewData["InvalidateOnPasswordChange"] = shouldSignout;
|
||||
|
||||
if (!ValidateChangePassword(currentPassword, newPassword, confirmPassword)) {
|
||||
return View();
|
||||
}
|
||||
|
||||
if (PasswordChangeIsSuccess(currentPassword, newPassword, _orchardServices.WorkContext.CurrentUser.UserName)) {
|
||||
if (shouldSignout) {
|
||||
_authenticationService.SignOut();
|
||||
|
||||
var loggedUser = _authenticationService.GetAuthenticatedUser();
|
||||
if (loggedUser != null) {
|
||||
_userEventHandler.LoggedOut(loggedUser);
|
||||
}
|
||||
|
||||
}
|
||||
return RedirectToAction("ChangePasswordSuccess");
|
||||
}
|
||||
else {
|
||||
|
||||
Reference in New Issue
Block a user