mirror of
https://github.com/nextcloud/all-in-one.git
synced 2025-12-21 23:16:59 +00:00
Clean code and use const
Signed-off-by: Jean-Yves <7360784+docjyJ@users.noreply.github.com>
This commit is contained in:
parent
d674ba4f6e
commit
56aa613dfb
2 changed files with 20 additions and 16 deletions
|
|
@ -4,14 +4,14 @@ namespace AIO\Auth;
|
|||
|
||||
use AIO\Data\ConfigurationManager;
|
||||
use AIO\Data\DataConst;
|
||||
use \DateTime;
|
||||
use DateTime;
|
||||
|
||||
class AuthManager {
|
||||
private const string SESSION_KEY = 'aio_authenticated';
|
||||
private ConfigurationManager $configurationManager;
|
||||
|
||||
public function __construct(ConfigurationManager $configurationManager) {
|
||||
$this->configurationManager = $configurationManager;
|
||||
public function __construct(
|
||||
private readonly ConfigurationManager $configurationManager
|
||||
) {
|
||||
}
|
||||
|
||||
public function CheckCredentials(string $password): bool {
|
||||
|
|
|
|||
|
|
@ -2,11 +2,11 @@
|
|||
|
||||
namespace AIO\Auth;
|
||||
|
||||
use AIO\Data\ConfigurationManager;
|
||||
use Random\RandomException;
|
||||
|
||||
class PasswordGenerator
|
||||
{
|
||||
private array $words = [
|
||||
class PasswordGenerator {
|
||||
|
||||
private const array WORDS = [
|
||||
'abacus',
|
||||
'abdomen',
|
||||
'abdominal',
|
||||
|
|
@ -7785,6 +7785,10 @@ class PasswordGenerator
|
|||
'zoom',
|
||||
];
|
||||
|
||||
|
||||
/**
|
||||
* @throws RandomException
|
||||
*/
|
||||
public function GeneratePassword(int $length): string {
|
||||
$password = '';
|
||||
|
||||
|
|
@ -7792,7 +7796,7 @@ class PasswordGenerator
|
|||
if ($password !== '') {
|
||||
$password = $password . ' ';
|
||||
}
|
||||
$password = $password . $this->words[random_int(0, 7775)];
|
||||
$password = $password . PasswordGenerator::WORDS[random_int(0, 7775)];
|
||||
}
|
||||
|
||||
return $password;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue