Fixed incorrect assignment of Last Login Date after a user accepts an invite and sets the password (#14619)
This commit is contained in:
@@ -217,14 +217,11 @@ public class CurrentUserController : UmbracoAuthorizedJsonController
|
||||
return ValidationProblem(ModelState);
|
||||
}
|
||||
|
||||
if (_backofficeSecurityAccessor.BackOfficeSecurity?.CurrentUser is not null)
|
||||
{
|
||||
//They've successfully set their password, we can now update their user account to be approved
|
||||
_backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.IsApproved = true;
|
||||
//They've successfully set their password, and will now get fully logged into the back office, so the lastlogindate is set so the backoffice shows they have logged in
|
||||
_backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser.LastLoginDate = DateTime.UtcNow;
|
||||
_userService.Save(_backofficeSecurityAccessor.BackOfficeSecurity.CurrentUser);
|
||||
}
|
||||
//They've successfully set their password, we can now update their user account to be approved
|
||||
user.IsApproved = true;
|
||||
//They've successfully set their password, and will now get fully logged into the back office, so the lastlogindate is set so the backoffice shows they have logged in
|
||||
user.LastLoginDateUtc = DateTime.UtcNow;
|
||||
await _backOfficeUserManager.UpdateAsync(user);
|
||||
|
||||
|
||||
//now we can return their full object since they are now really logged into the back office
|
||||
|
||||
Reference in New Issue
Block a user