mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
AdminAccountPage: Fix username validation
This commit is contained in:
parent
f615db01fe
commit
87cdd49b1c
@ -202,7 +202,7 @@ class AdminAccountPage extends Form
|
||||
return false;
|
||||
}
|
||||
|
||||
if ($data['user_type'] === 'new_user' && !$this->hasUser($data['new_user'])) {
|
||||
if ($data['user_type'] === 'new_user' && $this->hasUser($data['new_user'])) {
|
||||
$this->getElement('new_user')->addError($this->translate('Username already exists.'));
|
||||
return false;
|
||||
}
|
||||
@ -255,7 +255,11 @@ class AdminAccountPage extends Form
|
||||
*/
|
||||
protected function hasUser($username)
|
||||
{
|
||||
return $this->createBackend()->select()->where('user_name', $username)->count() > 1;
|
||||
try {
|
||||
return $this->createBackend()->select()->where('user_name', $username)->count() > 1;
|
||||
} catch (Exception $_) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user