Compare commits
No commits in common. "7fb75c9f25724520043856b3408f47bf3cd052bb" and "a2d6376e81098657bb48738ae01e565d7c1d441c" have entirely different histories.
7fb75c9f25
...
a2d6376e81
@ -89,9 +89,6 @@ var MapGuesser = {
|
||||
|
||||
formError.style.display = 'block';
|
||||
formError.innerHTML = this.response.error.errorText;
|
||||
if (typeof grecaptcha !== 'undefined') {
|
||||
grecaptcha.reset();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -364,24 +364,11 @@ class LoginController
|
||||
$newUser->setPlainPassword(\Container::$request->post('password'));
|
||||
}
|
||||
|
||||
if (strlen(\Container::$request->post('username')) > 0) {
|
||||
$username = \Container::$request->post('username');
|
||||
|
||||
if (preg_match('/^[a-zA-Z0-9_\-\.]+$/', $username) !== 1) {
|
||||
return new JsonContent(['error' => ['errorText' => 'Username can contain only english letters, digits, - (hyphen), . (dot), _ (underscore).']]);
|
||||
}
|
||||
|
||||
if ($this->userRepository->getByUsername($username) !== null) {
|
||||
return new JsonContent(['error' => ['errorText' => 'The given username is already taken.']]);
|
||||
}
|
||||
} else {
|
||||
$usernameGenerator = new UsernameGenerator();
|
||||
do {
|
||||
$username = $usernameGenerator->generate();
|
||||
} while ($this->userRepository->getByUsername($username));
|
||||
if (strlen(\Container::$request->post('username')) > 0 && preg_match('/^[a-zA-Z0-9_\-\.]+$/', \Container::$request->post('username')) !== 1) {
|
||||
return new JsonContent(['error' => ['errorText' => 'Username can contain only english letters, digits, - (hyphen), . (dot), _ (underscore).']]);
|
||||
}
|
||||
|
||||
$newUser->setUsername($username);
|
||||
$newUser->setUsername(strlen(\Container::$request->post('username')) > 0 ? \Container::$request->post('username') : (new UsernameGenerator())->generate());
|
||||
$newUser->setCreatedDate(new DateTime());
|
||||
|
||||
\Container::$persistentDataManager->saveToDb($newUser);
|
||||
|
Loading…
Reference in New Issue
Block a user