Documentation

ChangePassword

array
CUser::ChangePassword(
 string login,
 string checkword,
 string password,
 string CONFIRM_PASSWORD,
 string site_id = SITE_ID, 
 string captcha_word = "", 
 string captcha_sid = 0, 
 string authActions = true
)

The method modifies the user password and then calls CUser::SendUserInfo, which in its turn sends the e-mail message using the template USER_INFO. Returns an array containing the result message information. The array returned may be further processed by ShowMessage method. Non-static method.

Parameters

ParameterDescription Available from version
login user login.
checkword Check string used to change the password.
password New password.
CONFIRM_PASSWORD Password confirmation (to successfully change the password, the parameter must match with the new_password).
site_id Site ID for the USER_INFO mail template to send notifications.
Optional parameter. By default - current site.
captcha_word Word in CAPTCHA, if corresponding CAPTCHA option is enabled.
captcha_sid CAPTCHA identifier, if corresponding CAPTCHA option is enabled.
authActions Allows user authorization after password has changed. By default value is true, which means user authorization is denied.

See Also

Examples of use

<?
global $USER;
$arResult = $USER->ChangePassword("admin", "WRD45GT", "123456", "123456");
if($arResult["TYPE"] == "OK") echo "Password has been changed successfully.";
else ShowMessage($arResult);
?>


© «Bitrix24», 2001-2022
Up