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;
|
2020-08-12 17:03:09 -04:00
|
|
|
|
|
2021-12-14 15:05:07 +00:00
|
|
|
|
namespace Bit.Api.Models.Request.Accounts
|
2020-08-12 17:03:09 -04:00
|
|
|
|
{
|
|
|
|
|
|
public class SetPasswordRequestModel
|
|
|
|
|
|
{
|
|
|
|
|
|
[Required]
|
|
|
|
|
|
[StringLength(300)]
|
2020-08-17 10:40:35 -04:00
|
|
|
|
public string MasterPasswordHash { get; set; }
|
2020-08-12 17:03:09 -04:00
|
|
|
|
[Required]
|
|
|
|
|
|
public string Key { get; set; }
|
2020-08-17 10:40:35 -04:00
|
|
|
|
[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; }
|
2020-10-13 15:00:33 -05:00
|
|
|
|
public string OrgIdentifier { get; set; }
|
2020-08-17 10:40:35 -04:00
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
}
|
|
|
|
|
|
}
|