1
0
mirror of https://github.com/bitwarden/server synced 2025-12-17 16:53:23 +00:00

refactor for cipher details, folders, favorites

This commit is contained in:
Kyle Spearrin
2017-03-18 11:58:02 -04:00
parent 2b71420818
commit 588f6c7c2c
15 changed files with 139 additions and 138 deletions

View File

@@ -1,6 +1,7 @@
using System;
using Bit.Core.Models.Table;
using Newtonsoft.Json;
using Core.Models.Data;
namespace Bit.Core.Models.Api
{
@@ -28,7 +29,23 @@ namespace Bit.Core.Models.Api
public LoginDataModel(Cipher cipher)
{
if(cipher.Type != Core.Enums.CipherType.Login)
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;
}
public LoginDataModel(CipherDetails cipher)
{
if(cipher.Type != Enums.CipherType.Login)
{
throw new ArgumentException("Cipher is not correct type.");
}