Skip to content

Commit

Permalink
PHRAS-4073: Register form - improvement (#4520)
Browse files Browse the repository at this point in the history
* sanitize register form

* fix
  • Loading branch information
aynsix authored Jun 10, 2024
1 parent b709122 commit 0c0021d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion lib/Alchemy/Phrasea/Authentication/RegistrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@ public function registerUser(array $data, array $selectedCollections = null, $pr

foreach (self::$userPropertySetterMap as $property => $method) {
if (isset($data[$property])) {
$user->$method($data[$property]);
$user->$method($this->app['unicode']->remove_nonazAZ09($data[$property], true, true, true, true));
}
}

Expand Down
4 changes: 2 additions & 2 deletions lib/classes/unicode.php
Original file line number Diff line number Diff line change
Expand Up @@ -1643,7 +1643,7 @@ public function remove_diacritics($string)
return $this->convert($string, static::CONVERT_TO_ND);
}

public function remove_nonazAZ09($string, $keep_underscores = true, $keep_minus = true, $keep_dot = false)
public function remove_nonazAZ09($string, $keep_underscores = true, $keep_minus = true, $keep_dot = false, $keep_space = false)
{
$string = $this->remove_diacritics($string);

Expand All @@ -1652,7 +1652,7 @@ public function remove_nonazAZ09($string, $keep_underscores = true, $keep_minus
for ($i = 0; $i < $l; $i ++) {
$c = mb_substr($string, $i, 1);
if(($c>='a'&&$c<='z')||($c>='A'&&$c<='Z')||($c>='0'&&$c<='9')
||($keep_underscores&&$c=='_')||($keep_dot&&$c=='.')||($keep_minus&&$c=='-')) {
||($keep_underscores&&$c=='_')||($keep_dot&&$c=='.')||($keep_minus&&$c=='-')||($keep_space&&$c==' ')) {
$out .= $c;
}
}
Expand Down

0 comments on commit 0c0021d

Please sign in to comment.