Support usernames containing brackets (#3365)
* wrapped $user in preg_quote function * updated auth test for special character in username Co-authored-by: Léo Colombaro <git@colombaro.fr> Co-authored-by: ྅༻ Ǭɀħ ༄༆ཉ <ozh@ozh.org>
This commit is contained in:
parent
2efcb9e93a
commit
f2971a1a35
@ -213,7 +213,7 @@ function yourls_hash_passwords_now( $config_file ) {
|
||||
// PHP would interpret $ as a variable, so replace it in storage.
|
||||
$hash = str_replace( '$', '!', $hash );
|
||||
$quotes = "'" . '"';
|
||||
$pattern = "/[$quotes]{$user}[$quotes]\s*=>\s*[$quotes]" . preg_quote( $password, '/' ) . "[$quotes]/";
|
||||
$pattern = "/[$quotes]" . preg_quote( $user, '/' ) . "[$quotes]\s*=>\s*[$quotes]" . preg_quote( $password, '/' ) . "[$quotes]/";
|
||||
$replace = "'$user' => 'phpass:$hash' /* Password encrypted by YOURLS */ ";
|
||||
$count = 0;
|
||||
$configdata = preg_replace( $pattern, $replace, $configdata, -1, $count );
|
||||
|
@ -8,5 +8,6 @@ $yourls_user_passwords = array(
|
||||
'quote1' => '"ahah"',
|
||||
'quote2' => "'ahah'",
|
||||
'utf8fun' => 'أنا أحب النقانق',
|
||||
's[p]e(c)i{a}!@#$%^&*-=l<>,/?' => 'password',
|
||||
);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user