Amélioration de l'expérience utilisateur

This commit is contained in:
2024-09-09 20:27:54 +02:00
parent 76ddc9fe30
commit b087a7130c
13 changed files with 207 additions and 87 deletions

View File

@@ -43,7 +43,8 @@ class User extends \Piko\DbRecord implements \Piko\User\IdentityInterface
const SCENARIO_RESET = 'reset';
public static \PDO $pdo;
public static Module $module;
public int $passwordMinLength = 8;
/**
* The table name
@@ -267,11 +268,11 @@ class User extends \Piko\DbRecord implements \Piko\User\IdentityInterface
$this->errors['password'] = __('user', 'Password must be filled in.');
} elseif (($this->scenario == self::SCENARIO_REGISTER || $this->scenario == self::SCENARIO_RESET) &&
strlen($this->password) < static::$module->passwordMinLength) {
strlen($this->password) < $this->passwordMinLength) {
$this->errors['password'] = __(
'user',
'Password is to short. Minimum {num}: characters.',
['num' => static::$module->passwordMinLength]
['num' => (string) $this->passwordMinLength]
);
}
@@ -367,7 +368,7 @@ class User extends \Piko\DbRecord implements \Piko\User\IdentityInterface
$subject = __('user', 'Password change request on {site_name}', ['site_name' => $siteName]);
$mail = new Message();
$mail->setFrom($siteName . ' <' . getenv('NO_REPLY_EMAIL') . '>')
$mail->setFrom(getenv('NO_REPLY_EMAIL'), $siteName)
->addTo($this->email)
->setSubject($subject)
->setBody($message);