mirror of
https://github.com/pixelfed/pixelfed.git
synced 2024-12-26 01:36:43 +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'])) {
|
if(!isset($res['preferredUsername']) && !isset($res['nickname'])) {
|
||||||
return;
|
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']);
|
$username = (string) Purify::clean($res['preferredUsername'] ?? $res['nickname']);
|
||||||
if(empty($username)) {
|
if(empty($username)) {
|
||||||
return;
|
return;
|
||||||
|
|
Loading…
Reference in a new issue