1
0
mirror of https://github.com/bitwarden/server synced 2026-01-10 20:44:05 +00:00

[Reset Password v1] Update DB for Forced Reset (#1467)

* [Reset Password v1] Force Temp Password Changes

* Updated EF migrations/scripts

* Updating user sprocs with default bit value
This commit is contained in:
Vincent Salucci
2021-07-21 11:47:11 -05:00
committed by GitHub
parent 8e97b924d4
commit 4e486e5f5d
15 changed files with 3299 additions and 5 deletions

View File

@@ -30,6 +30,7 @@ namespace Bit.Core.Models.Api
Key = user.Key;
PrivateKey = user.PrivateKey;
SecurityStamp = user.SecurityStamp;
ForcePasswordReset = user.ForcePasswordReset;
Organizations = organizationsUserDetails?.Select(o => new ProfileOrganizationResponseModel(o));
Providers = providerUserDetails?.Select(p => new ProfileProviderResponseModel(p));
ProviderOrganizations =
@@ -47,6 +48,7 @@ namespace Bit.Core.Models.Api
public string Key { get; set; }
public string PrivateKey { get; set; }
public string SecurityStamp { get; set; }
public bool ForcePasswordReset { get; set; }
public IEnumerable<ProfileOrganizationResponseModel> Organizations { get; set; }
public IEnumerable<ProfileProviderResponseModel> Providers { get; set; }
public IEnumerable<ProfileProviderOrganizationResponseModel> ProviderOrganizations { get; set; }

View File

@@ -57,6 +57,7 @@ namespace Bit.Core.Models.Table
public int KdfIterations { get; set; } = 5000;
public DateTime CreationDate { get; internal set; } = DateTime.UtcNow;
public DateTime RevisionDate { get; internal set; } = DateTime.UtcNow;
public bool ForcePasswordReset { get; set; }
public void SetNewId()
{

View File

@@ -29,7 +29,8 @@
@KdfIterations INT,
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@ApiKey VARCHAR(30)
@ApiKey VARCHAR(30),
@ForcePasswordReset BIT = 0
AS
BEGIN
SET NOCOUNT ON
@@ -66,7 +67,8 @@ BEGIN
[KdfIterations],
[CreationDate],
[RevisionDate],
[ApiKey]
[ApiKey],
[ForcePasswordReset]
)
VALUES
(
@@ -100,6 +102,7 @@ BEGIN
@KdfIterations,
@CreationDate,
@RevisionDate,
@ApiKey
@ApiKey,
@ForcePasswordReset
)
END

View File

@@ -29,7 +29,8 @@
@KdfIterations INT,
@CreationDate DATETIME2(7),
@RevisionDate DATETIME2(7),
@ApiKey VARCHAR(30)
@ApiKey VARCHAR(30),
@ForcePasswordReset BIT = 0
AS
BEGIN
SET NOCOUNT ON
@@ -66,7 +67,8 @@ BEGIN
[KdfIterations] = @KdfIterations,
[CreationDate] = @CreationDate,
[RevisionDate] = @RevisionDate,
[ApiKey] = @ApiKey
[ApiKey] = @ApiKey,
[ForcePasswordReset] = @ForcePasswordReset
WHERE
[Id] = @Id
END

View File

@@ -30,6 +30,7 @@
[CreationDate] DATETIME2 (7) NOT NULL,
[RevisionDate] DATETIME2 (7) NOT NULL,
[ApiKey] VARCHAR (30) NOT NULL,
[ForcePasswordReset] BIT NOT NULL,
CONSTRAINT [PK_User] PRIMARY KEY CLUSTERED ([Id] ASC)
);