1
0
mirror of https://github.com/bitwarden/server.git synced 2025-07-01 08:02:49 -05:00

Added cipher service with bulk import to account controller

This commit is contained in:
Kyle Spearrin
2015-12-26 23:09:53 -05:00
parent 437b971003
commit 8d7178bc74
14 changed files with 246 additions and 29 deletions

View File

@ -0,0 +1,12 @@
using System;
using System.Collections.Generic;
namespace Bit.Api.Models
{
public class ImportRequestModel
{
public FolderRequestModel[] Folders { get; set; }
public SiteRequestModel[] Sites { get; set; }
public KeyValuePair<int, int>[] SiteRelationships { get; set; }
}
}

View File

@ -71,10 +71,6 @@ namespace Bit.Api.Models
{
yield return new ValidationResult("Uri is required for a site cypher.", new[] { "Uri" });
}
if(string.IsNullOrWhiteSpace(Username))
{
yield return new ValidationResult("Username is required for a site cypher.", new[] { "Username" });
}
if(string.IsNullOrWhiteSpace(Password))
{
yield return new ValidationResult("Password is required for a site cypher.", new[] { "Password" });

View File

@ -14,7 +14,6 @@ namespace Bit.Api.Models
[Required]
[EncryptedString]
public string Uri { get; set; }
[Required]
[EncryptedString]
public string Username { get; set; }
[Required]
@ -31,7 +30,7 @@ namespace Bit.Api.Models
FolderId = string.IsNullOrWhiteSpace(FolderId) ? null : FolderId,
Name = Name,
Uri = Uri,
Username = Username,
Username = string.IsNullOrWhiteSpace(Username) ? null : Username,
Password = Password,
Notes = string.IsNullOrWhiteSpace(Notes) ? null : Notes
};
@ -42,7 +41,7 @@ namespace Bit.Api.Models
existingSite.FolderId = string.IsNullOrWhiteSpace(FolderId) ? null : FolderId;
existingSite.Name = Name;
existingSite.Uri = Uri;
existingSite.Username = Username;
existingSite.Username = string.IsNullOrWhiteSpace(Username) ? null : Username;
existingSite.Password = Password;
existingSite.Notes = string.IsNullOrWhiteSpace(Notes) ? null : Notes;