From 381c379b855af60fa2960234bf80864ecd754aae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Patrick=20M=C3=BCller?= <p.mueller@pcsg.de> Date: Fri, 24 Nov 2017 08:53:45 +0100 Subject: [PATCH] refactor: set nobody as auth user if invalid username given --- src/QUI/Auth/Google2Fa/Auth.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/src/QUI/Auth/Google2Fa/Auth.php b/src/QUI/Auth/Google2Fa/Auth.php index d512339..98358f1 100644 --- a/src/QUI/Auth/Google2Fa/Auth.php +++ b/src/QUI/Auth/Google2Fa/Auth.php @@ -41,7 +41,14 @@ class Auth extends AbstractAuthenticator */ public function __construct($user = '') { - $this->User = QUI::getUsers()->getUserByName($user); + if (!empty($user)) { + try { + $this->User = QUI::getUsers()->getUserByName($user); + } catch (\Exception $Exception) { + $this->User = QUI::getUsers()->getNobody(); + } + } + $this->Google2FA = new Google2FA(); } -- GitLab