Implement account edit; add SessionHelper, PasswordHelper and ActionResult
This commit is contained in:
parent
32add30c9d
commit
6ace072841
15 changed files with 637 additions and 68 deletions
27
src/Common/PasswordHelper.php
Normal file
27
src/Common/PasswordHelper.php
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace MailAccountAdmin\Common;
|
||||
|
||||
class PasswordHelper
|
||||
{
|
||||
public function hashPassword(string $password): string
|
||||
{
|
||||
return password_hash($password, PASSWORD_DEFAULT);
|
||||
}
|
||||
|
||||
public function verifyPassword(string $password, string $hash): bool
|
||||
{
|
||||
return password_verify($password, $hash);
|
||||
}
|
||||
|
||||
public function getPasswordHashType(string $passwordHash): string
|
||||
{
|
||||
if ($passwordHash === '') {
|
||||
return 'empty';
|
||||
}
|
||||
|
||||
$passwordHashInfo = password_get_info($passwordHash);
|
||||
return $passwordHashInfo['algoName'] ?? 'unknown';
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue