mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-22 13:03:16 +00:00
Update AP helpers, improve preferredUsername validation
This commit is contained in:
parent
ff272292ef
commit
21218c794b
1 changed files with 7 additions and 0 deletions
|
@ -760,6 +760,13 @@ class Helpers {
|
|||
if(!isset($res['preferredUsername']) && !isset($res['nickname'])) {
|
||||
return;
|
||||
}
|
||||
// skip invalid usernames
|
||||
if(!ctype_alnum($res['preferredUsername'])) {
|
||||
$tmpUsername = str_replace(['_', '.', '-'], '', $res['preferredUsername']);
|
||||
if(!ctype_alnum($tmpUsername)) {
|
||||
return;
|
||||
}
|
||||
}
|
||||
$username = (string) Purify::clean($res['preferredUsername'] ?? $res['nickname']);
|
||||
if(empty($username)) {
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue