CreateAuthenticationSettingsFromPasswordHash (open)
Returns authentication settings with the specified password hash as current password.
Syntax
LOADLIB "mod::wrd/lib/auth.whlib";
RECORD FUNCTION CreateAuthenticationSettingsFromPasswordHash(STRING passwordhash, RECORD options)Parameters
STRING passwordhashCurrent password hash
RECORD optionsOptions
validfromDate when the password was set, defaults to current time
Return value
RECORDAuthentication settings
RECORD ARRAY passwordsList of passwords, last one is current valid password.
STRING passwords.passwordhashPassword hash.
DATETIME passwords.validfromDate from when this password hash. Must be increasing and smaller than GetCurrentDateTime().
RECORD totpTOTP second factor settings
RECORD ARRAY totp.backupcodesList of backup codes
STRING totp.backupcodes.codeBackup code
DATETIME totp.lockedDatime when normal code entry was locked due to too many failures
STRING totp.urlTOTP configuration url, see GetTOTPUrl
DATETIME totp.usedDate when backup code was used
INTEGER versionSettings version, should be 1.
Description
This should be used when creating new entities, but not to update password as using the returned value won't retain any password history and will reset 2FA settings