1
0
mirror of https://github.com/bitwarden/server.git synced 2025-02-03 23:51:21 +01:00

check to make sure user actually needs key update

This commit is contained in:
Kyle Spearrin 2018-07-31 08:19:49 -04:00
parent 6d22356caf
commit cf6334e37d

View File

@ -215,7 +215,7 @@ namespace Bit.Core.Services
var tokenValid = false;
if(_globalSettings.DisableUserRegistration && !string.IsNullOrWhiteSpace(token) && orgUserId.HasValue)
{
tokenValid = CoreHelpers.UserInviteTokenIsValid(_organizationServiceDataProtector, token,
tokenValid = CoreHelpers.UserInviteTokenIsValid(_organizationServiceDataProtector, token,
user.Email, orgUserId.Value);
}
@ -456,6 +456,11 @@ namespace Bit.Core.Services
if(await CheckPasswordAsync(user, masterPassword))
{
if(user.Key != null)
{
throw new BadRequestException("User already has an updated encryption key.");
}
user.RevisionDate = user.AccountRevisionDate = DateTime.UtcNow;
user.SecurityStamp = Guid.NewGuid().ToString();
user.Key = key;