Added Flappyzor hacks.
This commit is contained in:
parent
4087c23199
commit
e70aed3a2c
1 changed files with 17 additions and 0 deletions
|
@ -611,6 +611,9 @@ class User implements HasRankInterface, JsonSerializable {
|
||||||
if($name !== trim($name))
|
if($name !== trim($name))
|
||||||
return 'trim';
|
return 'trim';
|
||||||
|
|
||||||
|
if(str_starts_with(mb_strtolower($name), 'flappyzor'))
|
||||||
|
return 'flapp';
|
||||||
|
|
||||||
$length = mb_strlen($name);
|
$length = mb_strlen($name);
|
||||||
if($length < self::NAME_MIN_LENGTH)
|
if($length < self::NAME_MIN_LENGTH)
|
||||||
return 'short';
|
return 'short';
|
||||||
|
@ -644,6 +647,8 @@ class User implements HasRankInterface, JsonSerializable {
|
||||||
return 'Your username contains invalid characters.';
|
return 'Your username contains invalid characters.';
|
||||||
case 'in-use':
|
case 'in-use':
|
||||||
return 'This username is already taken!';
|
return 'This username is already taken!';
|
||||||
|
case 'flapp':
|
||||||
|
return 'Your username may not start with Flappyzor!';
|
||||||
case '':
|
case '':
|
||||||
return 'This username is correctly formatted!';
|
return 'This username is correctly formatted!';
|
||||||
default:
|
default:
|
||||||
|
@ -811,6 +816,10 @@ class User implements HasRankInterface, JsonSerializable {
|
||||||
}
|
}
|
||||||
public static function byUsername(string $username): ?self {
|
public static function byUsername(string $username): ?self {
|
||||||
$username = mb_strtolower($username);
|
$username = mb_strtolower($username);
|
||||||
|
|
||||||
|
if(str_starts_with($username, 'flappyzor'))
|
||||||
|
return self::byId(14);
|
||||||
|
|
||||||
return self::memoizer()->find(function($user) use ($username) {
|
return self::memoizer()->find(function($user) use ($username) {
|
||||||
return mb_strtolower($user->getUsername()) === $username;
|
return mb_strtolower($user->getUsername()) === $username;
|
||||||
}, function() use ($username) {
|
}, function() use ($username) {
|
||||||
|
@ -837,6 +846,10 @@ class User implements HasRankInterface, JsonSerializable {
|
||||||
}
|
}
|
||||||
public static function byUsernameOrEMailAddress(string $usernameOrAddress): self {
|
public static function byUsernameOrEMailAddress(string $usernameOrAddress): self {
|
||||||
$usernameOrAddressLower = mb_strtolower($usernameOrAddress);
|
$usernameOrAddressLower = mb_strtolower($usernameOrAddress);
|
||||||
|
|
||||||
|
if(!str_contains($usernameOrAddressLower, '@') && str_starts_with($usernameOrAddressLower, 'flappyzor'))
|
||||||
|
return self::byId(14);
|
||||||
|
|
||||||
return self::memoizer()->find(function($user) use ($usernameOrAddressLower) {
|
return self::memoizer()->find(function($user) use ($usernameOrAddressLower) {
|
||||||
return mb_strtolower($user->getUsername()) === $usernameOrAddressLower
|
return mb_strtolower($user->getUsername()) === $usernameOrAddressLower
|
||||||
|| mb_strtolower($user->getEmailAddress()) === $usernameOrAddressLower;
|
|| mb_strtolower($user->getEmailAddress()) === $usernameOrAddressLower;
|
||||||
|
@ -856,6 +869,10 @@ class User implements HasRankInterface, JsonSerializable {
|
||||||
}
|
}
|
||||||
public static function findForProfile($userIdOrName): ?self {
|
public static function findForProfile($userIdOrName): ?self {
|
||||||
$userIdOrNameLower = mb_strtolower($userIdOrName);
|
$userIdOrNameLower = mb_strtolower($userIdOrName);
|
||||||
|
|
||||||
|
if(str_starts_with($userIdOrNameLower, 'flappyzor'))
|
||||||
|
return self::byId(14);
|
||||||
|
|
||||||
return self::memoizer()->find(function($user) use ($userIdOrNameLower) {
|
return self::memoizer()->find(function($user) use ($userIdOrNameLower) {
|
||||||
return $user->getId() == $userIdOrNameLower || mb_strtolower($user->getUsername()) === $userIdOrNameLower;
|
return $user->getId() == $userIdOrNameLower || mb_strtolower($user->getUsername()) === $userIdOrNameLower;
|
||||||
}, function() use ($userIdOrName) {
|
}, function() use ($userIdOrName) {
|
||||||
|
|
Loading…
Reference in a new issue