AdministrativeResetPassword Method

Syntax

Context.Security.AdministrativeResetPassword as C (UserName as C)

Arguments

UserNameCharacter

The user name.

Returns

resultCharacter

The newly generated password. If the password reset fails, result will be blank.

Description

Reset the user's password to a generated password.

Discussion

Context.Security.AdministrativeResetPassword() reset the user's password to a generated password. This method can be used whether or not a password answer is required so its use should be limited to pages/code that require administrative access. The return value is the newly generated password. Check Context.Security.CallResult.Success before using the return value.

Example

dim username as c = "user_name_here"
dim newPassword as C
newPassword = Context.Security.AdministrativeResetPassword(username)
if (Context.Security.CallResult.Success <> .t.) then
    ' Could not reset password; newPassword will be blank
    error_generate(Context.Security.CallResult.Text)
end if