summaryrefslogtreecommitdiff
path: root/app/Controller/Auth.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-05-28 13:41:54 -0400
committerFrederic Guillot <fred@kanboard.net>2016-05-28 13:41:54 -0400
commit1353929a7dbd3f2e897fa7d3ab88e959ca573f9f (patch)
tree30bdbac4e466e74c3dfb4d451422f03c62bcbe41 /app/Controller/Auth.php
parentab48a09f0d674b703467975b376c5ac7352670ae (diff)
Rename controllers
Diffstat (limited to 'app/Controller/Auth.php')
-rw-r--r--app/Controller/Auth.php83
1 files changed, 0 insertions, 83 deletions
diff --git a/app/Controller/Auth.php b/app/Controller/Auth.php
deleted file mode 100644
index cad44a34..00000000
--- a/app/Controller/Auth.php
+++ /dev/null
@@ -1,83 +0,0 @@
-<?php
-
-namespace Kanboard\Controller;
-
-/**
- * Authentication controller
- *
- * @package controller
- * @author Frederic Guillot
- */
-class Auth extends BaseController
-{
- /**
- * Display the form login
- *
- * @access public
- * @param array $values
- * @param array $errors
- */
- public function login(array $values = array(), array $errors = array())
- {
- if ($this->userSession->isLogged()) {
- $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
- } else {
- $this->response->html($this->helper->layout->app('auth/index', array(
- 'captcha' => ! empty($values['username']) && $this->userLocking->hasCaptcha($values['username']),
- 'errors' => $errors,
- 'values' => $values,
- 'no_layout' => true,
- 'title' => t('Login')
- )));
- }
- }
-
- /**
- * Check credentials
- *
- * @access public
- */
- public function check()
- {
- $values = $this->request->getValues();
- $this->sessionStorage->hasRememberMe = ! empty($values['remember_me']);
- list($valid, $errors) = $this->authValidator->validateForm($values);
-
- if ($valid) {
- $this->redirectAfterLogin();
- } else {
- $this->login($values, $errors);
- }
- }
-
- /**
- * Logout and destroy session
- *
- * @access public
- */
- public function logout()
- {
- if (! DISABLE_LOGOUT) {
- $this->sessionManager->close();
- $this->response->redirect($this->helper->url->to('auth', 'login'));
- } else {
- $this->response->redirect($this->helper->url->to('auth', 'index'));
- }
- }
-
- /**
- * Redirect the user after the authentication
- *
- * @access private
- */
- private function redirectAfterLogin()
- {
- if (isset($this->sessionStorage->redirectAfterLogin) && ! empty($this->sessionStorage->redirectAfterLogin) && ! filter_var($this->sessionStorage->redirectAfterLogin, FILTER_VALIDATE_URL)) {
- $redirect = $this->sessionStorage->redirectAfterLogin;
- unset($this->sessionStorage->redirectAfterLogin);
- $this->response->redirect($redirect);
- } else {
- $this->response->redirect($this->helper->url->to('DashboardController', 'show'));
- }
- }
-}