Twofactor authentication and strong password

This commit is contained in:
2025-10-17 14:52:45 +02:00
parent 71a688f97f
commit dbd8c8aed2
17 changed files with 3055 additions and 14 deletions
+15
View File
@@ -135,5 +135,20 @@ class User extends BaseModel {
return $saltedpassword;
}
public static function generateSalt()
{
$alphabet = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890';
$alphaLength = strlen( $alphabet ) - 1;
$randomString = '';
for ( $i = 0; $i < 18; $i++ )
{
$n = rand( 0, $alphaLength );
$randomString .= $alphabet[ $n ];
}
return sha1( $randomString );
}
}