1
0
mirror of https://github.com/bitwarden/server.git synced 2024-11-24 12:35:25 +01:00

If no ciphers yet, just save user when changing password/email

This commit is contained in:
Kyle Spearrin 2016-10-05 22:03:02 -04:00
parent 3521646489
commit c954683133
2 changed files with 20 additions and 2 deletions

1
.gitignore vendored
View File

@ -198,3 +198,4 @@ FakesAssemblies/
# Other
project.lock.json
*.jfm

View File

@ -142,7 +142,16 @@ namespace Bit.Core.Services
user.Email = newEmail;
user.EmailVerified = true;
user.RevisionDate = DateTime.UtcNow;
if(ciphers.Any())
{
await _cipherRepository.UpdateUserEmailPasswordAndCiphersAsync(user, ciphers);
}
else
{
await _userRepository.ReplaceAsync(user);
}
return IdentityResult.Success;
}
@ -167,7 +176,15 @@ namespace Bit.Core.Services
}
user.RevisionDate = DateTime.UtcNow;
if(ciphers.Any())
{
await _cipherRepository.UpdateUserEmailPasswordAndCiphersAsync(user, ciphers);
}
else
{
await _userRepository.ReplaceAsync(user);
}
return IdentityResult.Success;
}