Использование базового TOTP через мобильное приложение вместо существующей реализации второго пароля на javascript.

This commit is contained in:
2024-05-09 19:19:14 +03:00
parent 85b74015b7
commit 244e081014
7 changed files with 260 additions and 494 deletions
-23
View File
@@ -57,28 +57,5 @@ class Password
}
return $this->info['pass'];
}
public function changeSecond(?int $passLength): array
{
if (in_array($passLength, [4, 6, 8])) {
$query = 'update users set pass2 = ? where id = ?';
$pass2 = PassGen::intCode($passLength);
$args = [
password_hash($pass2, PASSWORD_DEFAULT),
$this->info['id'],
];
Confirmation::byEmail($this->info, 'pass2', $pass2);
$hash = $args[0];
} else {
$query = 'update users set pass2 = default where id = ?';
$args = [$this->info['id']];
}
Db::sql($query, $args);
return [
'pass2' => $pass2 ?? '',
'hash' => $hash ?? null,
];
}
}