mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-01-24 05:42:10 +08:00
Logon crash when checking if password is expired (#8624)
* Added null check for last password change date. If that is null, use user date creation to check for password expiration. * Added nullable date checks in AccountController ChangeExpiredPassword action too.
This commit is contained in:
committed by
GitHub
parent
0234738573
commit
ab7ebd65c9
@@ -332,7 +332,11 @@ namespace Orchard.Users.Controllers {
|
||||
var membershipSettings = _membershipService.GetSettings();
|
||||
var userPart = _membershipService.GetUser(username).As<UserPart>();
|
||||
var lastPasswordChangeUtc = userPart.LastPasswordChangeUtc;
|
||||
if (lastPasswordChangeUtc.Value.AddDays(membershipSettings.PasswordExpirationTimeInDays) > _clock.UtcNow &&
|
||||
// If there is no last password change date, use user creation date.
|
||||
if (lastPasswordChangeUtc == null) {
|
||||
lastPasswordChangeUtc = userPart.CreatedUtc;
|
||||
}
|
||||
if (lastPasswordChangeUtc != null && lastPasswordChangeUtc.Value.AddDays(membershipSettings.PasswordExpirationTimeInDays) > _clock.UtcNow &&
|
||||
!userPart.ForcePasswordChange) {
|
||||
return RedirectToAction("LogOn");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user