diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-08-15 17:23:41 -0700 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-08-15 17:23:41 -0700 |
commit | 9eeded33f68872515954a2fc177fcb47a9273ae9 (patch) | |
tree | f3ef9507e087ca6bf3ce624232da240a8689b051 /app/Model/ReverseProxyAuth.php | |
parent | c539bdc8ab746c5afd48cf87de057dc38d50adac (diff) |
Add email notifications
Diffstat (limited to 'app/Model/ReverseProxyAuth.php')
-rw-r--r-- | app/Model/ReverseProxyAuth.php | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/app/Model/ReverseProxyAuth.php b/app/Model/ReverseProxyAuth.php index 1b9ed06c..14d18ba3 100644 --- a/app/Model/ReverseProxyAuth.php +++ b/app/Model/ReverseProxyAuth.php @@ -23,24 +23,22 @@ class ReverseProxyAuth extends Base if (isset($_SERVER[REVERSE_PROXY_USER_HEADER])) { $login = $_SERVER[REVERSE_PROXY_USER_HEADER]; - $userModel = new User($this->db, $this->event); - $user = $userModel->getByUsername($login); + $user = $this->user->getByUsername($login); if (! $user) { $this->createUser($login); - $user = $userModel->getByUsername($login); + $user = $this->user->getByUsername($login); } // Create the user session - $userModel->updateSession($user); + $this->user->updateSession($user); // Update login history - $lastLogin = new LastLogin($this->db, $this->event); - $lastLogin->create( + $this->lastLogin->create( LastLogin::AUTH_REVERSE_PROXY, $user['id'], - $userModel->getIpAddress(), - $userModel->getUserAgent() + $this->user->getIpAddress(), + $this->user->getUserAgent() ); return true; @@ -58,9 +56,7 @@ class ReverseProxyAuth extends Base */ private function createUser($login) { - $userModel = new User($this->db, $this->event); - - return $userModel->create(array( + return $this->user->create(array( 'email' => strpos($login, '@') !== false ? $login : '', 'username' => $login, 'is_admin' => REVERSE_PROXY_DEFAULT_ADMIN === $login, |