Exemple #1
0
/**
 * This custom exception handler is only called if the MainUI file is included
 */
function wifidog_exception_handler($e)
{
    $exceptionClass = get_class($e);
    switch ($exceptionClass) {
        case 'SecurityException':
            $html = null;
            $html .= "<div class = 'errormsg'>\n";
            $user = User::getCurrentUser();
            if ($user) {
                $html .= sprintf(_("Your current user (%s) does not have the required level of access.  Please login with with a user with the required permission(s) to try this operation again."), $user->getUserName());
            } else {
                $html .= sprintf(_("You didn't log-in or your session timed-out.  Please login to try this operation again."));
            }
            $html .= "</div>\n";
            $html .= "<form name='login_form' id='login_form' action='' method='post'>\n";
            require_once 'classes/Authenticator.php';
            $html .= Authenticator::getLoginUI();
            $html .= "</form>\n";
            $html .= "<div class = 'warningmsg'>\n";
            $html .= sprintf(_("%s"), $e->getMessage());
            $html .= "<pre>\n";
            $html .= sprintf(_("%s was thrown in %s, line %d\n"), get_class($e), $e->getFile(), $e->getLine());
            $html .= $e->getTraceAsString();
            $html .= "</pre>\n";
            $html .= "</div>\n";
            exception_output_helper($html);
            break;
        default:
            //@ob_clean();
            $html = null;
            $html .= "<div class = 'errormsg'>\n";
            $html .= sprintf(_("Detailed error was:  Uncaught %s %s (%s) thrown in file %s, line %d"), get_class($e), $e->getMessage(), $e->getCode(), $e->getFile(), $e->getLine());
            $html .= "<pre>\n";
            $html .= $e->getTraceAsString();
            $html .= "</pre>\n";
            $html .= "</div>\n";
            exception_output_helper($html);
    }
}
 private static function serverLoginForm($request, $msg = null, User $user)
 {
     $url = $request->identity;
     $name = self::DEPRECATEDgetUsernameFromOpenIdUrl($url);
     $trust_root = $request->trust_root;
     $ui = MainUI::getObject();
     $html = null;
     $action = BASE_URL_PATH . "openid/?mode=Login";
     $html .= "<form method='post' action='{$action}'>\n";
     $userData['preSelectedUser'] = $user;
     $html .= Authenticator::getLoginUI($userData);
     $html .= "</form>\n";
     $ui->addContent('main_area_top', $html);
     $ui->display();
 }
Exemple #3
0
$html = "";
$html .= "<form name='login_form'  id='login_form' action='" . BASE_SSL_PATH . "login/index.php' method='post'>\n";
$html .= "<input type='hidden' name='form_request' value='login'>\n";
if ($gw_address != null) {
    $html .= "<input type='hidden' name='gw_address' value='{$gw_address}'>\n";
}
if ($gw_port != null) {
    $html .= "<input type='hidden' name='gw_port' value='{$gw_port}'>\n";
}
if ($gw_id != null) {
    $html .= "<input type='hidden' name='gw_id' value='{$gw_id}'>\n";
}
if ($mac != null) {
    $html .= "<input type='hidden' name='mac' value='{$mac}'>\n";
}
$html .= Authenticator::getLoginUI();
$html .= "</form>\n";
$html .= "<div id='login_help'>\n";
$html .= "<h1>" . _("I'm having difficulties:") . "</h1>\n";
$html .= "<ul>\n";
$html .= "<li><a href='" . BASE_URL_PATH . "lost_username.php'>" . _("I Forgot my username") . "</a></li>\n";
$html .= "<li><a href='" . BASE_URL_PATH . "lost_password.php'>" . _("I Forgot my password") . "</a></li>\n";
$html .= "<li><a href='" . BASE_URL_PATH . "resend_validation.php'>" . _("Re-send the validation email") . "</a></li>\n";
$html .= "</ul>\n";
$html .= "</div>\n";
$ui = MainUI::getObject();
if ($node) {
    $ui->setTitle(sprintf(_("%s login page for %s"), $network->getName(), $node->getName()));
} else {
    $ui->setTitle(_("Offsite login page"));
}