X-Git-Url: https://git.cweiske.de/phorkie.git/blobdiff_plain/3f0ffc6181c329dd2c1ee05d220b4b82ea907e36..6eef15cdc3bef5971d8ffe95bcbcaff368c87e69:/www/login.php
diff --git a/www/login.php b/www/login.php
index a2cf97c..a97246f 100644
--- a/www/login.php
+++ b/www/login.php
@@ -34,11 +34,7 @@ $returnTo = Tools::fullUrl('/login');
try {
$o = new \OpenID_RelyingParty($returnTo, $realm, $openid_url);
} catch (OpenID_Exception $e) {
- $contents = "
\n";
- $contents .= "
" . $e->getMessage() . "
\n";
- $contents .= "
";
- include_once 'openid/wrapper.php';
- exit;
+ throw new Exception($e->getMessage());
}
if (!empty($_POST['disable_associations']) || !empty($_SESSION['disable_associations'])) {
@@ -55,11 +51,7 @@ if (isset($_POST['openid_url'])) {
try {
$authRequest = $o->prepare();
} catch (OpenID_Exception $e) {
- $contents = "\n";
- $contents .= "
" . $e->getMessage() . "
\n";
- $contents .= "
";
- include_once 'openid/wrapper.php';
- exit;
+ throw new Exception($e->getMessage());
}
// SREG
@@ -77,7 +69,7 @@ if (isset($_POST['openid_url'])) {
$authRequest->addExtension($ax);
$url = $authRequest->getAuthorizeURL();
-
+
header("Location: $url");
exit;
@@ -116,7 +108,7 @@ try {
} catch (OpenID_Exception $e) {
$status = "Status: | EXCEPTION!";
$status .= " ({$e->getMessage()} : {$e->getCode()}) |
";
- }
+}
$openid = $message->getArrayFormat();
@@ -149,7 +141,11 @@ $name = isset($openid['openid.sreg.fullname']) && !isset($name)
$_SESSION['name'] = isset($name) ? $name : $_SERVER['REMOTE_ADDR'];
$_SESSION['identity'] = $openid['openid.identity'];
-$redirect = 'http://' . $_SERVER['HTTP_HOST'] . $_SESSION['REQUEST_URI'];
+if (isset($_SESSION['REQUEST_URI'])) {
+ $redirect = Tools::fullUrl($_SESSION['REQUEST_URI']);
+} else {
+ $redirect = Tools::fullUrl('/');
+}
header('Location: ' . filter_var($redirect, FILTER_SANITIZE_URL));
exit;
?>