mirror of
https://github.com/bitwarden/server.git
synced 2025-04-09 15:18:13 -05:00
store password history and revision dates
This commit is contained in:
parent
91765477c5
commit
5c31a35cfe
@ -1,10 +1,10 @@
|
|||||||
using System.ComponentModel.DataAnnotations;
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
using Bit.Core.Utilities;
|
using Bit.Core.Utilities;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Bit.Core.Models.Data;
|
using Bit.Core.Models.Data;
|
||||||
using Newtonsoft.Json;
|
|
||||||
|
|
||||||
namespace Bit.Core.Models.Api
|
namespace Bit.Core.Models.Api
|
||||||
{
|
{
|
||||||
@ -22,6 +22,7 @@ namespace Bit.Core.Models.Api
|
|||||||
|
|
||||||
Username = data.Username;
|
Username = data.Username;
|
||||||
Password = data.Password;
|
Password = data.Password;
|
||||||
|
PasswordRevisionDate = data.PasswordRevisionDate;
|
||||||
Totp = data.Totp;
|
Totp = data.Totp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -52,6 +53,7 @@ namespace Bit.Core.Models.Api
|
|||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
[StringLength(1000)]
|
[StringLength(1000)]
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
[EncryptedString]
|
[EncryptedString]
|
||||||
[StringLength(1000)]
|
[StringLength(1000)]
|
||||||
public string Totp { get; set; }
|
public string Totp { get; set; }
|
||||||
|
23
src/Core/Models/Api/CipherPasswordHistoryModel.cs
Normal file
23
src/Core/Models/Api/CipherPasswordHistoryModel.cs
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using Bit.Core.Models.Data;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.Api
|
||||||
|
{
|
||||||
|
public class CipherPasswordHistoryModel
|
||||||
|
{
|
||||||
|
public CipherPasswordHistoryModel() { }
|
||||||
|
|
||||||
|
public CipherPasswordHistoryModel(CipherPasswordHistoryData data)
|
||||||
|
{
|
||||||
|
Password = data.Password;
|
||||||
|
LastUsedDate = data.LastUsedDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
[StringLength(2000)]
|
||||||
|
[Required]
|
||||||
|
public string Password { get; set; }
|
||||||
|
[Required]
|
||||||
|
public DateTime? LastUsedDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
@ -28,6 +28,7 @@ namespace Bit.Core.Models.Api
|
|||||||
[StringLength(10000)]
|
[StringLength(10000)]
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public IEnumerable<CipherFieldModel> Fields { get; set; }
|
public IEnumerable<CipherFieldModel> Fields { get; set; }
|
||||||
|
public IEnumerable<CipherPasswordHistoryModel> PasswordHistory { get; set; }
|
||||||
public Dictionary<string, string> Attachments { get; set; }
|
public Dictionary<string, string> Attachments { get; set; }
|
||||||
|
|
||||||
public CipherLoginModel Login { get; set; }
|
public CipherLoginModel Login { get; set; }
|
||||||
|
@ -55,6 +55,7 @@ namespace Bit.Core.Models.Api
|
|||||||
Name = cipherData.Name;
|
Name = cipherData.Name;
|
||||||
Notes = cipherData.Notes;
|
Notes = cipherData.Notes;
|
||||||
Fields = cipherData.Fields?.Select(f => new CipherFieldModel(f));
|
Fields = cipherData.Fields?.Select(f => new CipherFieldModel(f));
|
||||||
|
PasswordHistory = cipherData.PasswordHistory?.Select(ph => new CipherPasswordHistoryModel(ph));
|
||||||
RevisionDate = cipher.RevisionDate;
|
RevisionDate = cipher.RevisionDate;
|
||||||
OrganizationId = cipher.OrganizationId?.ToString();
|
OrganizationId = cipher.OrganizationId?.ToString();
|
||||||
Attachments = AttachmentResponseModel.FromCipher(cipher, globalSettings);
|
Attachments = AttachmentResponseModel.FromCipher(cipher, globalSettings);
|
||||||
@ -72,6 +73,7 @@ namespace Bit.Core.Models.Api
|
|||||||
public CipherIdentityModel Identity { get; set; }
|
public CipherIdentityModel Identity { get; set; }
|
||||||
public CipherSecureNoteModel SecureNote { get; set; }
|
public CipherSecureNoteModel SecureNote { get; set; }
|
||||||
public IEnumerable<CipherFieldModel> Fields { get; set; }
|
public IEnumerable<CipherFieldModel> Fields { get; set; }
|
||||||
|
public IEnumerable<CipherPasswordHistoryModel> PasswordHistory { get; set; }
|
||||||
public IEnumerable<AttachmentResponseModel> Attachments { get; set; }
|
public IEnumerable<AttachmentResponseModel> Attachments { get; set; }
|
||||||
public bool OrganizationUseTotp { get; set; }
|
public bool OrganizationUseTotp { get; set; }
|
||||||
public DateTime RevisionDate { get; set; }
|
public DateTime RevisionDate { get; set; }
|
||||||
|
@ -13,10 +13,12 @@ namespace Bit.Core.Models.Data
|
|||||||
Name = cipher.Name;
|
Name = cipher.Name;
|
||||||
Notes = cipher.Notes;
|
Notes = cipher.Notes;
|
||||||
Fields = cipher.Fields?.Select(f => new CipherFieldData(f));
|
Fields = cipher.Fields?.Select(f => new CipherFieldData(f));
|
||||||
|
PasswordHistory = cipher.PasswordHistory?.Select(ph => new CipherPasswordHistoryData(ph));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; }
|
||||||
public string Notes { get; set; }
|
public string Notes { get; set; }
|
||||||
public IEnumerable<CipherFieldData> Fields { get; set; }
|
public IEnumerable<CipherFieldData> Fields { get; set; }
|
||||||
|
public IEnumerable<CipherPasswordHistoryData> PasswordHistory { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Bit.Core.Enums;
|
using Bit.Core.Enums;
|
||||||
using Bit.Core.Models.Api;
|
using Bit.Core.Models.Api;
|
||||||
@ -17,6 +18,7 @@ namespace Bit.Core.Models.Data
|
|||||||
Uris = cipher.Login.Uris?.Where(u => u != null).Select(u => new CipherLoginUriData(u));
|
Uris = cipher.Login.Uris?.Where(u => u != null).Select(u => new CipherLoginUriData(u));
|
||||||
Username = cipher.Login.Username;
|
Username = cipher.Login.Username;
|
||||||
Password = cipher.Login.Password;
|
Password = cipher.Login.Password;
|
||||||
|
PasswordRevisionDate = cipher.Login.PasswordRevisionDate;
|
||||||
Totp = cipher.Login.Totp;
|
Totp = cipher.Login.Totp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -28,6 +30,7 @@ namespace Bit.Core.Models.Data
|
|||||||
public IEnumerable<CipherLoginUriData> Uris { get; set; }
|
public IEnumerable<CipherLoginUriData> Uris { get; set; }
|
||||||
public string Username { get; set; }
|
public string Username { get; set; }
|
||||||
public string Password { get; set; }
|
public string Password { get; set; }
|
||||||
|
public DateTime? PasswordRevisionDate { get; set; }
|
||||||
public string Totp { get; set; }
|
public string Totp { get; set; }
|
||||||
|
|
||||||
public class CipherLoginUriData
|
public class CipherLoginUriData
|
||||||
|
19
src/Core/Models/Data/CipherPasswordHistoryData.cs
Normal file
19
src/Core/Models/Data/CipherPasswordHistoryData.cs
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
using System;
|
||||||
|
using Bit.Core.Models.Api;
|
||||||
|
|
||||||
|
namespace Bit.Core.Models.Data
|
||||||
|
{
|
||||||
|
public class CipherPasswordHistoryData
|
||||||
|
{
|
||||||
|
public CipherPasswordHistoryData() { }
|
||||||
|
|
||||||
|
public CipherPasswordHistoryData(CipherPasswordHistoryModel phModel)
|
||||||
|
{
|
||||||
|
Password = phModel.Password;
|
||||||
|
LastUsedDate = phModel.LastUsedDate.Value;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string Password { get; set; }
|
||||||
|
public DateTime LastUsedDate { get; set; }
|
||||||
|
}
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user