mirror of
https://github.com/bitwarden/server
synced 2025-12-19 01:33:20 +00:00
[SG-998] Move files to Vault folders (#2724)
* Move Api files * Move Core files * Move Infrastructure files * Move Sql Files * Move Api Sync files to Vault * Move test vault files * Update Sql.sqlproj paths * Update Codeowners * Fix vault file paths in sqlproj * Update CipherDetails.sql path in sqlproj * Update Core models and entities namespaces * Update namespaces Core Services and Repositories * Missed service namespaces * Update Api namespaces * Update Infrastructure namespaces * Move infrastructure queries that were missed * Tests namespace updates * Admin and Events namespace updates * Remove unused usings * Remove extra CiphersController usings * Rename folder * Fix CipherDetails namespace * Sqlproj fixes * Move stored procs into folders by table * using order fix
This commit is contained in:
84
src/Api/Vault/Models/CipherLoginModel.cs
Normal file
84
src/Api/Vault/Models/CipherLoginModel.cs
Normal file
@@ -0,0 +1,84 @@
|
||||
using Bit.Core.Enums;
|
||||
using Bit.Core.Utilities;
|
||||
using Bit.Core.Vault.Models.Data;
|
||||
|
||||
namespace Bit.Api.Vault.Models;
|
||||
|
||||
public class CipherLoginModel
|
||||
{
|
||||
public CipherLoginModel() { }
|
||||
|
||||
public CipherLoginModel(CipherLoginData data)
|
||||
{
|
||||
Uris = data.Uris?.Select(u => new CipherLoginUriModel(u))?.ToList();
|
||||
if (!Uris?.Any() ?? true)
|
||||
{
|
||||
Uri = data.Uri;
|
||||
}
|
||||
|
||||
Username = data.Username;
|
||||
Password = data.Password;
|
||||
PasswordRevisionDate = data.PasswordRevisionDate;
|
||||
Totp = data.Totp;
|
||||
AutofillOnPageLoad = data.AutofillOnPageLoad;
|
||||
}
|
||||
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(10000)]
|
||||
public string Uri
|
||||
{
|
||||
get => Uris?.FirstOrDefault()?.Uri;
|
||||
set
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(value))
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (Uris == null)
|
||||
{
|
||||
Uris = new List<CipherLoginUriModel>();
|
||||
}
|
||||
|
||||
Uris.Add(new CipherLoginUriModel(value));
|
||||
}
|
||||
}
|
||||
public List<CipherLoginUriModel> Uris { get; set; }
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(1000)]
|
||||
public string Username { get; set; }
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(5000)]
|
||||
public string Password { get; set; }
|
||||
public DateTime? PasswordRevisionDate { get; set; }
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(1000)]
|
||||
public string Totp { get; set; }
|
||||
public bool? AutofillOnPageLoad { get; set; }
|
||||
|
||||
public class CipherLoginUriModel
|
||||
{
|
||||
public CipherLoginUriModel() { }
|
||||
|
||||
public CipherLoginUriModel(string uri)
|
||||
{
|
||||
Uri = uri;
|
||||
}
|
||||
|
||||
public CipherLoginUriModel(CipherLoginData.CipherLoginUriData uri)
|
||||
{
|
||||
Uri = uri.Uri;
|
||||
Match = uri.Match;
|
||||
}
|
||||
|
||||
[EncryptedString]
|
||||
[EncryptedStringLength(10000)]
|
||||
public string Uri { get; set; }
|
||||
public UriMatchType? Match { get; set; } = null;
|
||||
|
||||
public CipherLoginData.CipherLoginUriData ToCipherLoginUriData()
|
||||
{
|
||||
return new CipherLoginData.CipherLoginUriData { Uri = Uri, Match = Match, };
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user