Xbasic
beforePasswordChange
Description
Fires before the user's password is changed.
Discussion
Two Xbasic events are available when a user changes their password in the UX Login component. The beforePasswordChange event fires before the password is changed and the afterPasswordChange event fires after the password has been changed.
The typical use case for these events is to store recently used password hashes in a database (using the afterPasswordChange event) so that you can prevent the user from reusing a previously used password (in the beforePasswordChange event).
Prototype
The beforePasswordChange event handler has the following prototype:
function proto_beforepasswordchange as c () proto_beforepasswordchange = <<%code% function __name__ as c (e as p) 'Called before the user's password is changed (in the UX Login component). 'A common use case for this function is to prevent the user from changing the password to a password that was recentely used. 'Your code can reference: ' e.newpasswordHash = The hashed value of the password the user is trying to set ' e.userid - the userId of the user. ' 'typically you would use the afterPasswordReset event to store the e.newpasswordHash and the e.userid in a SQL table. 'Your code in this event can check that the user is not selecing a previously used password. ' 'Your code can set these properties: ' e.allowed - set to .f. if the user set a password that is not allowed. ' if e.allowed is set to .f. then you can set ' e.errorText - the error message to display ' end function %code%
See Also