Problem: Failed logins always try log in against legacy upstream
Solution: Make the login fallback optional and deactivate it in the default config. I'm leaving the code in here mostly because I want to revisit it and make it modular so I can later on plug my own FreeIPA things :)
This commit is contained in:
parent
4557395a86
commit
10532dc4e8
2 changed files with 27 additions and 15 deletions
|
@ -106,7 +106,8 @@ define('UI_PLAYLISTCONTROLLER_OBJ_SESSNAME', 'PLAYLISTCONTROLLER_OBJ');
|
||||||
define('UI_BLOCK_SESSNAME', 'BLOCK');*/
|
define('UI_BLOCK_SESSNAME', 'BLOCK');*/
|
||||||
|
|
||||||
//WHMCS integration
|
//WHMCS integration
|
||||||
define("WHMCS_API_URL", "https://account.sourcefabric.com/includes/api.php");
|
define("LIBRETIME_ENABLE_WHMCS", false);
|
||||||
|
define("WHMCS_API_URL", "https://account.example.org/includes/api.php");
|
||||||
define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain");
|
define("SUBDOMAIN_WHMCS_CUSTOM_FIELD_NAME", "Choose your domain");
|
||||||
|
|
||||||
//Sentry error logging
|
//Sentry error logging
|
||||||
|
|
|
@ -45,7 +45,7 @@ class LoginController extends Zend_Controller_Action
|
||||||
//uses separate layout without a navigation.
|
//uses separate layout without a navigation.
|
||||||
$this->_helper->layout->setLayout('login');
|
$this->_helper->layout->setLayout('login');
|
||||||
|
|
||||||
$error = false;
|
$this->view->error = false;
|
||||||
|
|
||||||
$baseUrl = Application_Common_OsPath::getBaseDir();
|
$baseUrl = Application_Common_OsPath::getBaseDir();
|
||||||
|
|
||||||
|
@ -92,7 +92,7 @@ class LoginController extends Zend_Controller_Action
|
||||||
Application_Model_Preference::SetUserLocale($locale);
|
Application_Model_Preference::SetUserLocale($locale);
|
||||||
|
|
||||||
$this->_redirect('showbuilder');
|
$this->_redirect('showbuilder');
|
||||||
} else {
|
} elseif (LIBRETIME_ENABLE_WHMCS) {
|
||||||
$email = $form->getValue('username');
|
$email = $form->getValue('username');
|
||||||
$authAdapter = new WHMCS_Auth_Adapter("admin", $email, $password);
|
$authAdapter = new WHMCS_Auth_Adapter("admin", $email, $password);
|
||||||
$auth = Zend_Auth::getInstance();
|
$auth = Zend_Auth::getInstance();
|
||||||
|
@ -105,23 +105,14 @@ class LoginController extends Zend_Controller_Action
|
||||||
$this->_redirect('showbuilder');
|
$this->_redirect('showbuilder');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
$message = _("Wrong username or password provided. Please try again.");
|
$form = $this->loginError($username);
|
||||||
Application_Model_Subjects::increaseLoginAttempts($username);
|
|
||||||
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
|
|
||||||
$form = new Application_Form_Login();
|
|
||||||
$error = true;
|
|
||||||
//Only show the captcha if you get your login wrong 4 times in a row.
|
|
||||||
if (Application_Model_Subjects::getLoginAttempts($username) > 3)
|
|
||||||
{
|
|
||||||
$form->addRecaptcha();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
$form = $this->loginError($username);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->view->message = $message;
|
|
||||||
$this->view->error = $error;
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
$this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion();
|
$this->view->airtimeVersion = Application_Model_Preference::GetAirtimeVersion();
|
||||||
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
|
$this->view->airtimeCopyright = AIRTIME_COPYRIGHT_DATE;
|
||||||
|
@ -260,4 +251,24 @@ class LoginController extends Zend_Controller_Action
|
||||||
|
|
||||||
$this->view->form = $form;
|
$this->view->form = $form;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* populates view with results from a login error and adds a new form
|
||||||
|
*
|
||||||
|
* @param String $username user that failed to login
|
||||||
|
* @return new form
|
||||||
|
*/
|
||||||
|
private function loginError($username)
|
||||||
|
{
|
||||||
|
$this->view->message = _("Wrong username or password provided. Please try again.");
|
||||||
|
Application_Model_Subjects::increaseLoginAttempts($username);
|
||||||
|
Application_Model_LoginAttempts::increaseAttempts($_SERVER['REMOTE_ADDR']);
|
||||||
|
$form = new Application_Form_Login();
|
||||||
|
$this->view->error = true;
|
||||||
|
//Only show the captcha if you get your login wrong 4 times in a row.
|
||||||
|
if (Application_Model_Subjects::getLoginAttempts($username) > 3) {
|
||||||
|
$form->addRecaptcha();
|
||||||
|
}
|
||||||
|
return $form;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue