Twofactor authentication and strong password
This commit is contained in:
@@ -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 );
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user