Add Exception when password is empty in User::hashPassword()

This commit is contained in:
Hypolite Petovan 2018-04-18 22:49:14 -04:00
parent b73d5a641f
commit 0496822ca3

View File

@ -258,6 +258,10 @@ class User
*/ */
public static function hashPassword($password) public static function hashPassword($password)
{ {
if (!trim($password)) {
throw new Exception(L10n::t('Password can\'t be empty'));
}
return password_hash($password, PASSWORD_DEFAULT); return password_hash($password, PASSWORD_DEFAULT);
} }