Update IsUniqueName.php
This commit is contained in:
parent
9a064e3b89
commit
c192090acc
1 changed files with 4 additions and 2 deletions
|
@ -17,14 +17,16 @@ class IsUniqueName extends Action
|
|||
$vars = [
|
||||
':id' => (int) $user->id,
|
||||
':name' => $user->username,
|
||||
':other' => \preg_replace('%[^\p{L}\p{N}]%u', '', $user->username), //???? что за бред :)
|
||||
];
|
||||
$query = 'SELECT u.username
|
||||
FROM ::users AS u
|
||||
WHERE (LOWER(u.username)=LOWER(?s:name) OR LOWER(u.username)=LOWER(?s:other)) AND u.id!=?i:id';
|
||||
WHERE LOWER(u.username)=LOWER(?s:name) AND u.id!=?i:id';
|
||||
|
||||
$result = $this->c->DB->query($query, $vars)->fetchAll();
|
||||
|
||||
return ! \count($result);
|
||||
|
||||
// ???? нужен нормализованный username для определения уникальности
|
||||
// это https://www.unicode.org/Public/security/latest/confusables.txt преобразование не очень :(
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue