Files
server/util/Migrator/DbScripts/2026-02-28_02_AlterUpdateMasterPassword.sql
Ike 0d88aa1ca1 [PM-21925] Add MasterPasswordSalt Column to User Table (#6950)
feat: add MasterPasswordSalt column to User table

- Add MasterPasswordSalt column to User table in both Dapper and EF implementations
- Update User stored procedures (Create, Update, UpdateMasterPassword) to handle salt column
- Add EF migrations and update UserView with dependent views
- Set MaxLength constraint on MasterPasswordSalt column
- Update UserRepository implementations to manage salt field
- Add comprehensive test coverage for salt handling and normalization
2026-03-05 11:47:08 -05:00

34 lines
946 B
Transact-SQL

CREATE OR ALTER PROCEDURE [dbo].[User_UpdateMasterPassword]
@Id UNIQUEIDENTIFIER,
@MasterPassword NVARCHAR(300),
@MasterPasswordHint NVARCHAR(50) = NULL,
@Key VARCHAR(MAX),
@Kdf TINYINT,
@KdfIterations INT,
@KdfMemory INT = NULL,
@KdfParallelism INT = NULL,
@RevisionDate DATETIME2(7),
@AccountRevisionDate DATETIME2(7),
@MasterPasswordSalt NVARCHAR(256) = NULL -- NULL for backwards compat.
AS
BEGIN
SET NOCOUNT ON
UPDATE
[dbo].[User]
SET
[MasterPassword] = @MasterPassword,
[MasterPasswordHint] = @MasterPasswordHint,
[Key] = @Key,
[Kdf] = @Kdf,
[KdfIterations] = @KdfIterations,
[KdfMemory] = @KdfMemory,
[KdfParallelism] = @KdfParallelism,
[RevisionDate] = @RevisionDate,
[AccountRevisionDate] = @AccountRevisionDate,
[MasterPasswordSalt] = @MasterPasswordSalt
WHERE
[Id] = @Id
END
GO