diff --git a/src/Core/Models/Api/LoginDataModel.cs b/src/Core/Models/Api/LoginDataModel.cs index 1ec08b3f5e..bd9a601fb7 100644 --- a/src/Core/Models/Api/LoginDataModel.cs +++ b/src/Core/Models/Api/LoginDataModel.cs @@ -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(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; } } } diff --git a/src/Core/Models/Api/Request/CipherRequestModel.cs b/src/Core/Models/Api/Request/CipherRequestModel.cs index f2f92b2d38..71b948ec65 100644 --- a/src/Core/Models/Api/Request/CipherRequestModel.cs +++ b/src/Core/Models/Api/Request/CipherRequestModel.cs @@ -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) { diff --git a/src/Core/Models/Api/Request/LoginRequestModel.cs b/src/Core/Models/Api/Request/LoginRequestModel.cs index efcc834d0c..7b3b6b81b3 100644 --- a/src/Core/Models/Api/Request/LoginRequestModel.cs +++ b/src/Core/Models/Api/Request/LoginRequestModel.cs @@ -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) {