Update Pages\Register for auto calc {hash}

This commit is contained in:
Visman 2021-03-07 16:43:59 +07:00
parent d2429f5def
commit 60c098577e

View file

@ -226,13 +226,13 @@ class Register extends Page
// отправка письма активации аккаунта
if ('1' == $this->c->config->o_regs_verify) {
$hash = $this->c->Secury->hash($newUserId . $key);
$this->c->Csrf->setHashExpiration(259200); // ???? хэш действует 72 часа
$link = $this->c->Router->link(
'RegActivate',
[
'id' => $newUserId,
'key' => $key,
'hash' => $hash,
]
);
$tplData = [
@ -356,7 +356,7 @@ class Register extends Page
public function activate(array $args): Page
{
if (
! \hash_equals($args['hash'], $this->c->Secury->hash($args['id'] . $args['key']))
! $this->c->Csrf->verify($args['hash'], 'RegActivate', $args)
|| ! ($user = $this->c->users->load($args['id'])) instanceof User
|| ! \hash_equals($user->activate_string, $args['key'])
) {