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:
12
src/Api/Models/Request/Accounts/ImportRequestModel.cs
Normal file
12
src/Api/Models/Request/Accounts/ImportRequestModel.cs
Normal 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; }
|
||||
}
|
||||
}
|
@ -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" });
|
||||
|
@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user