mirror of
https://github.com/bitwarden/server.git
synced 2025-01-13 20:21:22 +01:00
add support for totp secret in login cipher data
This commit is contained in:
parent
12af24e5f8
commit
f30faedc87
@ -1,7 +1,6 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
using Newtonsoft.Json;
|
||||
using Core.Models.Data;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
@ -16,6 +15,7 @@ namespace Bit.Core.Models.Api
|
||||
Username = login.Username;
|
||||
Password = login.Password;
|
||||
Notes = login.Notes;
|
||||
Totp = login.Totp;
|
||||
}
|
||||
|
||||
public LoginDataModel(CipherRequestModel cipher)
|
||||
@ -25,6 +25,7 @@ namespace Bit.Core.Models.Api
|
||||
Username = cipher.Username;
|
||||
Password = cipher.Password;
|
||||
Notes = cipher.Notes;
|
||||
Totp = cipher.Totp;
|
||||
}
|
||||
|
||||
public LoginDataModel(Cipher cipher)
|
||||
@ -41,22 +42,7 @@ namespace Bit.Core.Models.Api
|
||||
Username = data.Username;
|
||||
Password = data.Password;
|
||||
Notes = data.Notes;
|
||||
}
|
||||
|
||||
public LoginDataModel(CipherDetails cipher)
|
||||
{
|
||||
if(cipher.Type != Enums.CipherType.Login)
|
||||
{
|
||||
throw new ArgumentException("Cipher is not correct type.");
|
||||
}
|
||||
|
||||
var data = JsonConvert.DeserializeObject<LoginDataModel>(cipher.Data);
|
||||
|
||||
Name = data.Name;
|
||||
Uri = data.Uri;
|
||||
Username = data.Username;
|
||||
Password = data.Password;
|
||||
Notes = data.Notes;
|
||||
Totp = data.Totp;
|
||||
}
|
||||
|
||||
public string Name { get; set; }
|
||||
@ -64,5 +50,6 @@ namespace Bit.Core.Models.Api
|
||||
public string Username { get; set; }
|
||||
public string Password { get; set; }
|
||||
public string Notes { get; set; }
|
||||
public string Totp { get; set; }
|
||||
}
|
||||
}
|
||||
|
@ -34,6 +34,9 @@ namespace Bit.Core.Models.Api
|
||||
[EncryptedString]
|
||||
[StringLength(10000)]
|
||||
public string Notes { get; set; }
|
||||
[EncryptedString]
|
||||
[StringLength(300)]
|
||||
public string Totp { get; set; }
|
||||
|
||||
public virtual Cipher ToCipher(Guid userId)
|
||||
{
|
||||
|
@ -30,6 +30,9 @@ namespace Bit.Core.Models.Api
|
||||
[EncryptedString]
|
||||
[StringLength(10000)]
|
||||
public string Notes { get; set; }
|
||||
[EncryptedString]
|
||||
[StringLength(300)]
|
||||
public string Totp { get; set; }
|
||||
|
||||
public CipherDetails ToCipherDetails(Guid userId)
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user