aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--data/templates/login.htm6
-rw-r--r--www/auth.php46
-rw-r--r--www/css/openid.css2
-rw-r--r--www/www-header.php5
4 files changed, 29 insertions, 30 deletions
diff --git a/data/templates/login.htm b/data/templates/login.htm
index 154994a..7e724b0 100644
--- a/data/templates/login.htm
+++ b/data/templates/login.htm
@@ -15,12 +15,12 @@
<div id="openid_choice" style="display: block; ">
<p>Please choose your account provider</p>
<div id="openid_btns">
- <a title="Google" href="/auth?identifier=https://www.google.com/accounts/o8/id&ax=on&sreg=on&start=submit" class="google openid_large_btn"></a>
- <a title="Yahoo" href="/auth?identifier=http://yahoo.com&ax=on&sreg=on&start=submit" class="yahoo openid_large_btn"></a>
+ <a title="Google" href="/auth?openid_url=https://www.google.com/accounts/o8/id&start=submit" class="google openid_large_btn"></a>
+ <a title="Yahoo" href="/auth?openid_url=http://yahoo.com&start=submit" class="yahoo openid_large_btn"></a>
</div>
<div id="openid_input_area">
<p>or enter your OpenID URL.</p>
- <input class="" id="identifier" type="text" name="identifier" value="http://">
+ <input class="" id="openid_url" type="text" name="openid_url" value="http://">
<input class="btn" id="openid_submit" type="submit" value="Sign-In">
</div>
</div>
diff --git a/www/auth.php b/www/auth.php
index 1cafd59..29d7b37 100644
--- a/www/auth.php
+++ b/www/auth.php
@@ -41,16 +41,16 @@ if (!count($_POST) && isset($_GET['start'])) {
$_POST = $_GET;
}
-if (isset($_POST['identifier'])) {
- $identifier = $_POST['identifier'];
-} else if (isset($_SESSION['identifier'])) {
- $identifier = $_SESSION['identifier'];
+if (isset($_POST['openid_url'])) {
+ $openid_url = $_POST['openid_url'];
+} else if (isset($_SESSION['openid_url'])) {
+ $openid_url = $_SESSION['openid_url'];
} else {
- $identifier = null;
+ $openid_url = null;
}
try {
- $o = new OpenID_RelyingParty($returnTo, $realm, $identifier);
+ $o = new OpenID_RelyingParty($returnTo, $realm, $openid_url);
} catch (OpenID_Exception $e) {
$contents = "<div class='openid_results'>\n";
$contents .= "<pre>" . $e->getMessage() . "</pre>\n";
@@ -69,7 +69,7 @@ OpenID::attach($log);
if (isset($_POST['start'])) {
- $_SESSION['identifier'] = $identifier;
+ $_SESSION['openid_url'] = $openid_url;
try {
$authRequest = $o->prepare();
} catch (OpenID_Exception $e) {
@@ -86,23 +86,19 @@ if (isset($_POST['start'])) {
}
// SREG
- if (!empty($_POST['sreg'])) {
- $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST);
- $sreg->set('required', 'email,firstname,lastname,nickname');
- $sreg->set('optional', 'gender,dob');
- $authRequest->addExtension($sreg);
- }
+ $sreg = new OpenID_Extension_SREG11(OpenID_Extension::REQUEST);
+ $sreg->set('required', 'email,firstname,lastname,nickname');
+ $sreg->set('optional', 'gender,dob');
+ $authRequest->addExtension($sreg);
// AX
- if (!empty($_POST['ax'])) {
- $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST);
- $ax->set('type.email', 'http://axschema.org/contact/email');
- $ax->set('type.firstname', 'http://axschema.org/namePerson/first');
- $ax->set('type.lastname', 'http://axschema.org/namePerson/last');
- $ax->set('mode', 'fetch_request');
- $ax->set('required', 'email,firstname,lastname');
- $authRequest->addExtension($ax);
- }
+ $ax = new OpenID_Extension_AX(OpenID_Extension::REQUEST);
+ $ax->set('type.email', 'http://axschema.org/contact/email');
+ $ax->set('type.firstname', 'http://axschema.org/namePerson/first');
+ $ax->set('type.lastname', 'http://axschema.org/namePerson/last');
+ $ax->set('mode', 'fetch_request');
+ $ax->set('required', 'email,firstname,lastname');
+ $authRequest->addExtension($ax);
// UI
if (!empty($_POST['ui'])) {
@@ -136,9 +132,9 @@ if (isset($_POST['start'])) {
}
} else {
- if (isset($_SESSION['identifier'])) {
- $usid = $_SESSION['identifier'];
- unset($_SESSION['identifier']);
+ if (isset($_SESSION['openid_url'])) {
+ $usid = $_SESSION['openid_url'];
+ unset($_SESSION['openid_url']);
} else {
$usid = null;
}
diff --git a/www/css/openid.css b/www/css/openid.css
index 38988a7..296618b 100644
--- a/www/css/openid.css
+++ b/www/css/openid.css
@@ -25,7 +25,7 @@ body {
background-color: #FFFCC9;
float: left;
}
-#identifier {
+#openid_url {
margin: 0px !important;
width: 250px;
background: #FFF url(/images/openid-inputicon.gif) no-repeat scroll 0 50%;
diff --git a/www/www-header.php b/www/www-header.php
index 64dca11..96cd481 100644
--- a/www/www-header.php
+++ b/www/www-header.php
@@ -1,6 +1,9 @@
<?php
namespace phorkie;
-session_start();
+if (session_id() == "") {
+ session_start();
+}
+
set_include_path(
__DIR__ . '/../src/'
. PATH_SEPARATOR . get_include_path()