PreUpdatePasswordProcedure

Type: Stored procedure

The stored procedure specified by the system setting PreUpdatePasswordProcedure is called when a user changes their password using the built in Change password menu item.

It is not called when an administrator changes the user's password, or if another procedure calls SoftadminApi.User_UpdatePassword directly.

If you need to enforce a password policy, use PasswordPolicyFulfillsPolicyProcedure instead.

Example

CREATE PROCEDURE CustomPreUpdatePasswordProcedure
	@UserId      int,
	@NewPassword nvarchar(255),
	@LanguageId  int
AS
BEGIN
	DECLARE @HashedPassword varbinary(4000) = SoftadminUtil.Password_Hash(@NewPassword, DEFAULT);

	INSERT INTO PasswordLog (UserId, HashedPassword, InsertDatetime)
	VALUES (@UserId, @HashedPassword, SYSDATETIMEOFFSET());
END;

Parameters

@NewPassword mandatory nvarchar(200)
The user's new password.
@UserId mandatory int
ID of the user the password belongs to.
@LanguageId mandatory int
Language ID.