@@ -71,9 +71,9 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
71
71
$ usernameColumnName = $ this ->getProperty ('usernameColumn ' , 'username ' );
72
72
$ usernameColumn = $ table ->getColumn ($ usernameColumnName );
73
73
$ passwordColumnName = $ this ->getProperty ('passwordColumn ' , 'password ' );
74
- $ usernamePattern = $ this ->getProperty ('usernamePattern ' ,'/^[A-Za-z0-9] +$/ ' ); // specify regex pattern for username, defaults to alphanumeric characters
74
+ $ usernamePattern = $ this ->getProperty ('usernamePattern ' , '/^\p{L} +$/u ' ); // defaults to visible chars,unicode mode and no punctuation
75
75
$ usernameMinLength = (int )$ this ->getProperty ('usernameMinLength ' ,5 );
76
- $ usernameMaxLength = (int )$ this ->getProperty ('usernameMaxLength ' ,30 );
76
+ $ usernameMaxLength = (int )$ this ->getProperty ('usernameMaxLength ' ,255 );
77
77
if ($ usernameMinLength > $ usernameMaxLength ){
78
78
//obviously, $usernameMinLength should be less than $usernameMaxLength, but we'll still check in case of mis-config then we'll swap the 2 values
79
79
$ lesser = $ usernameMaxLength ;
@@ -129,8 +129,7 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
129
129
}else if ($ key === $ passwordColumnName ){
130
130
$ data [$ passwordColumnName ] = password_hash ($ password , PASSWORD_DEFAULT );
131
131
}else {
132
- $ data [$ key ] = filter_var ($ value , FILTER_VALIDATE_EMAIL ) ? $ value : filter_var ($ value ,FILTER_SANITIZE_ENCODED );
133
- //sanitize all other inputs, except for valid or properly formatted email address
132
+ $ data [$ key ] = htmlspecialchars ($ value );
134
133
}
135
134
}
136
135
}
@@ -142,11 +141,11 @@ public function process(ServerRequestInterface $request, RequestHandlerInterface
142
141
* query 2,3 or more times.
143
142
* As a TEMPORARY WORKAROUND, we'll just attempt to register the new user and wait for the db to throw a DUPLICATE KEY EXCEPTION.
144
143
*/
145
- }catch (\PDOException error ){
144
+ }catch (\PDOException $ error ){
146
145
if ($ error ->getCode () ==="23000 " ){
147
146
return $ this ->responder ->error (ErrorCode::DUPLICATE_KEY_EXCEPTION ,'' ,$ error ->getMessage ());
148
147
}else {
149
- return $ this ->responder ->error (ErrorCode::INPUT_VALIDATION_FAILED ,$ $ error ->getMessage ());
148
+ return $ this ->responder ->error (ErrorCode::INPUT_VALIDATION_FAILED ,$ error ->getMessage ());
150
149
}
151
150
}
152
151
$ users = $ this ->db ->selectAll ($ table , $ columnNames , $ condition , $ columnOrdering , 0 , 1 );
0 commit comments