fixup! make it possible to change email and username
This commit is contained in:
parent
26d6c0922c
commit
2cd55daf3b
@ -167,8 +167,8 @@ class UserController implements IAuthenticationRequired
|
||||
|
||||
$newUsername = \Container::$request->post('username');
|
||||
if (strlen($newUsername) > 0 && $newUsername !== $user->getUsername()) {
|
||||
if (filter_var($newUsername, FILTER_VALIDATE_EMAIL)) {
|
||||
return new JsonContent(['error' => ['errorText' => 'Please select a username that is not a valid email address.']]);
|
||||
if (preg_match('/^[a-zA-Z0-9_\-\.]+$/', $newUsername) !== 1) {
|
||||
return new JsonContent(['error' => ['errorText' => 'Username can contain only english letters, digits, - (hyphen), . (dot), _ (underscore).']]);
|
||||
}
|
||||
|
||||
if ($this->userRepository->getByUsername($newUsername) !== null) {
|
||||
|
Loading…
Reference in New Issue
Block a user