Alexandre Alapetite
2017-02-25 12:39:08 +01:00
parent 2e871a0adf
commit 271a1fdc89
11 changed files with 17 additions and 12 deletions

View File

@@ -34,9 +34,14 @@ class FreshRSS_user_Controller extends Minz_ActionController {
return $passwordHash == '' ? '' : $passwordHash;
}
/**
* The username is also used as folder name, and part of SQL table name.
* '_' is a reserved internal username.
*/
const USERNAME_PATTERN = '[0-9a-zA-Z]|[0-9a-zA-Z_]{2,38}';
public static function checkUsername($username) {
$match = '/^[0-9a-zA-Z_]{1,38}$/';
return preg_match($match, $username) === 1;
return preg_match('/^' . self::USERNAME_PATTERN . '$/', $username) === 1;
}
/**