1
0
mirror of https://github.com/bitwarden/server.git synced 2025-05-22 03:54:33 -05:00

check for keys already existing

This commit is contained in:
Kyle Spearrin 2017-04-13 18:27:30 -04:00
parent 5a24b6624d
commit 63e95f0f55

View File

@ -11,12 +11,16 @@ namespace Bit.Core.Models.Api
public User ToUser(User existingUser)
{
if(!string.IsNullOrWhiteSpace(PublicKey))
if(string.IsNullOrWhiteSpace(existingUser.PublicKey) && !string.IsNullOrWhiteSpace(PublicKey))
{
existingUser.PublicKey = PublicKey;
}
existingUser.PrivateKey = EncryptedPrivateKey;
if(string.IsNullOrWhiteSpace(existingUser.PrivateKey))
{
existingUser.PrivateKey = EncryptedPrivateKey;
}
return existingUser;
}
}