/** * Login function * * @return void * @access private */ function login() { $login_ok = false; $this->_loadStorage(); // Check if using challenge responce isset($this->post['authsecret']) && $this->post['authsecret'] == 1 ? $usingChap = true : ($usingChap = false); /** * When the user has already entered a username, * we have to validate it. */ if (!empty($this->username)) { if (true === $this->storage->fetchData($this->username, $this->password, $usingChap)) { $this->session['challengekey'] = md5($this->username . $this->password); $login_ok = true; } } if (!empty($this->username) && $login_ok) { $this->setAuth($this->username); if (is_callable($this->loginCallback)) { call_user_func_array($this->loginCallback, array($this->username, &$this)); } } /** * If the login failed or the user entered no username, * output the login screen again. */ if (!empty($this->username) && !$login_ok) { $this->status = AUTH_WRONG_LOGIN; if (is_callable($this->loginFailedCallback)) { call_user_func_array($this->loginFailedCallback, array($this->username, &$this)); } } if ((empty($this->username) || !$login_ok) && $this->showLogin) { if (is_callable($this->loginFunction)) { call_user_func_array($this->loginFunction, array($this->username, $this->status, &$this)); } else { // BC fix Auth used to use drawLogin for this // call is sub classes implement this if (is_callable(array(&$this, 'drawLogin'))) { return $this->drawLogin($this->username, &$this); } // New Login form include_once 'Auth/Frontend/Html.php'; return Auth_Frontend_Html::render($this, $this->username); } } else { return; } }
/** * Login function * * @return void * @access private */ function login() { $this->log('Auth::login() called.', AUTH_LOG_DEBUG); $login_ok = false; $this->_loadStorage(); // Check if using challenge response isset($this->post['authsecret']) && $this->post['authsecret'] == 1 ? $usingChap = true : ($usingChap = false); // When the user has already entered a username, we have to validate it. if (!empty($this->username)) { if (true === $this->storage->fetchData($this->username, $this->password, $usingChap)) { $this->session['challengekey'] = md5($this->username . $this->password); $login_ok = true; $this->log('Successful login.', AUTH_LOG_INFO); } } if (!empty($this->username) && $login_ok) { $this->setAuth($this->username); if (is_callable($this->loginCallback)) { $this->log('Calling loginCallback (' . $this->loginCallback . ').', AUTH_LOG_DEBUG); call_user_func_array($this->loginCallback, array($this->username, &$this)); } } // If the login failed or the user entered no username, // output the login screen again. if (!empty($this->username) && !$login_ok) { $this->log('Incorrect login.', AUTH_LOG_INFO); $this->status = AUTH_WRONG_LOGIN; if (is_callable($this->loginFailedCallback)) { $this->log('Calling loginFailedCallback (' . $this->loginFailedCallback . ').', AUTH_LOG_DEBUG); call_user_func_array($this->loginFailedCallback, array($this->username, &$this)); } } if ((empty($this->username) || !$login_ok) && $this->showLogin) { $this->log('Rendering Login Form.', AUTH_LOG_INFO); if (is_callable($this->loginFunction)) { $this->log('Calling loginFunction (' . $this->loginFunction . ').', AUTH_LOG_DEBUG); call_user_func_array($this->loginFunction, array($this->username, $this->status, &$this)); } else { // BC fix Auth used to use drawLogin for this // call is sub classes implement this if (is_callable(array($this, 'drawLogin'))) { $this->log('Calling Auth::drawLogin()', AUTH_LOG_DEBUG); return $this->drawLogin($this->username, $this); } $this->log('Using default Auth_Frontend_Html', AUTH_LOG_DEBUG); // New Login form include_once 'Auth/Frontend/Html.php'; return Auth_Frontend_Html::render($this, $this->username); } } else { return; } }