2020-08-17 10:40:35 -04:00
|
|
|
|
using System.ComponentModel.DataAnnotations;
|
2022-01-11 10:40:51 +01:00
|
|
|
|
using Bit.Core.Entities;
|
2020-08-17 10:40:35 -04:00
|
|
|
|
using Bit.Core.Enums;
|
2022-01-17 13:21:51 +01:00
|
|
|
|
using Bit.Core.Models.Api.Request.Accounts;
|
2020-08-12 17:03:09 -04:00
|
|
|
|
|
2022-08-29 15:53:48 -04:00
|
|
|
|
namespace Bit.Api.Models.Request.Accounts
|
2020-08-12 17:03:09 -04:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
public class SetPasswordRequestModel
|
2022-08-29 14:53:16 -04:00
|
|
|
|
{
|
2022-08-29 15:53:48 -04:00
|
|
|
|
[Required]
|
|
|
|
|
|
[StringLength(300)]
|
|
|
|
|
|
public string MasterPasswordHash { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public string Key { get; set; }
|
|
|
|
|
|
[StringLength(50)]
|
|
|
|
|
|
public string MasterPasswordHint { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public KeysRequestModel Keys { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public KdfType Kdf { get; set; }
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
public int KdfIterations { get; set; }
|
|
|
|
|
|
public string OrgIdentifier { get; set; }
|
|
|
|
|
|
|
|
|
|
|
|
public User ToUser(User existingUser)
|
|
|
|
|
|
{
|
|
|
|
|
|
existingUser.MasterPasswordHint = MasterPasswordHint;
|
|
|
|
|
|
existingUser.Kdf = Kdf;
|
|
|
|
|
|
existingUser.KdfIterations = KdfIterations;
|
|
|
|
|
|
existingUser.Key = Key;
|
|
|
|
|
|
Keys.ToUser(existingUser);
|
|
|
|
|
|
return existingUser;
|
|
|
|
|
|
}
|
2020-08-12 17:03:09 -04:00
|
|
|
|
}
|
|
|
|
|
|
}
|