PHRAS-4073: Register form - improvement (#4520)

* sanitize register form

* fix
This commit is contained in:
Aina Sitraka
2024-06-10 17:09:57 +03:00
committed by GitHub
parent b7091228dc
commit 0c0021d001
2 changed files with 3 additions and 3 deletions

View File

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

View File

@@ -1643,7 +1643,7 @@ class unicode
return $this->convert($string, static::CONVERT_TO_ND); 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); $string = $this->remove_diacritics($string);
@@ -1652,7 +1652,7 @@ class unicode
for ($i = 0; $i < $l; $i ++) { for ($i = 0; $i < $l; $i ++) {
$c = mb_substr($string, $i, 1); $c = mb_substr($string, $i, 1);
if(($c>='a'&&$c<='z')||($c>='A'&&$c<='Z')||($c>='0'&&$c<='9') 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; $out .= $c;
} }
} }