예제 #1
0
    $errorCode = NULL;
    // Initialize a new session.
    $state[sspmod_authTiqr_Auth_Tiqr::SESSIONKEYID] = sspmod_authTiqr_Auth_Tiqr::startAuthenticationSession($userId, $state);
    SimpleSAML_Auth_State::saveState($state, sspmod_authTiqr_Auth_Tiqr::STAGEID);
}
$push = false;
$enroll = false;
$mayCreate = true;
$enrollUrl = "";
$globalConfig = SimpleSAML_Configuration::getInstance();
$t = new SimpleSAML_XHTML_Template($globalConfig, 'authTiqr:login.php');
$t->data['stateparams'] = array('AuthState' => $authState);
if (isset($state["tiqrUser"])) {
    $mayCreate = false;
    // 2 factor authentication
    if (!sspmod_authTiqr_Auth_Tiqr::isEnrolled($state["tiqrUser"]["userId"])) {
        $enrollUrl = SimpleSAML_Module::getModuleURL('authTiqr/newuser.php', array('AuthState' => $authState));
        $enroll = true;
    } else {
        // we have a user. Send notification.
        $push = sspmod_authTiqr_Auth_Tiqr::sendAuthNotification($authState);
    }
} else {
    $enrollUrl = SimpleSAML_Module::getModuleURL('authTiqr/newuser.php', $t->data['stateparams']);
}
$t->data['errorcode'] = $errorCode;
if ($attemptsLeft != NULL) {
    $t->data['attemptsLeft'] = $attemptsLeft;
}
$t->data['push'] = $push;
$t->data['enroll'] = $enroll;