revised auth procedure to support 4eyes auth

This commit is contained in:
SJ
2015-02-19 15:17:20 +01:00
parent c1e525b931
commit bc8d264778
3 changed files with 121 additions and 77 deletions

View File

@ -37,13 +37,25 @@ class ControllerLoginGA extends Controller {
$GA = new PHPGangsta_GoogleAuthenticator();
$settings = $this->model_user_prefs->get_ga_settings($session->get('username'));
$data = $session->get("auth_data");
if(!isset($data['username'])) {
header("Location: " . SITE_URL . "/login.php");
exit;
}
$settings = $this->model_user_prefs->get_ga_settings($data['username']);
if(strlen($this->request->post['ga_code']) > 5 && $GA->verifyCode($settings['ga_secret'], $this->request->post['ga_code'], 2)) {
syslog(LOG_INFO, "GA auth successful for " . $data['username']);
$session->set("ga_block", "");
$this->model_user_prefs->get_user_preferences($session->get('username'));
$this->model_user_auth->apply_user_auth_session($data);
$session->remove("auth_data");
$this->model_user_prefs->get_user_preferences($session->get($data['username']));
if(ENABLE_SAAS == 1) {
$this->model_saas_customer->online($session->get('email'));

View File

@ -48,6 +48,10 @@ class ControllerLoginLogin extends Controller {
exit;
}
else {
$data = $session->get("auth_data");
$this->model_user_auth->apply_user_auth_session($data);
$session->remove("auth_data");
$this->model_user_prefs->get_user_preferences($session->get('username'));
if(ENABLE_SAAS == 1) {