Bitrix Site Manager

CUser::LoginByHash

mixed
CUser::LoginByHash(
 string login,
 string cookie_hash
)

The method LoginByHash verifies the login and a password hash string that CUser::GetPasswordHash and performs or declines the user authorization depending on the verification result. Returns true on successful authorization. In case the authorization failed, the method returns the error description array that can be passed to ShowMessage.

Parameters

ParameterDescription
login User login.
cookie_hash Special password hash string obtained by a call to CUser::GetPasswordHash. This hash string is stored in the user cookie.

See Also

Example



<?
global $USER;
if (!is_object($USER)) $USER = new CUser;
$cookie_login = ${COption::GetOptionString("main", "cookie_name", "BITRIX_SM")."_LOGIN"};
$cookie_md5pass = ${COption::GetOptionString("main", "cookie_name", "BITRIX_SM")."_UIDH"};
$USER->LoginByHash($cookie_login, $cookie_md5pass);
?>