FIX: login - sreg/ax default, identifier renamed to openid_url
authorJustin J. Novack <jnovack@gmail.com>
Mon, 17 Sep 2012 19:30:15 +0000 (15:30 -0400)
committerJustin J. Novack <jnovack@gmail.com>
Mon, 17 Sep 2012 19:30:15 +0000 (15:30 -0400)
data/templates/login.htm
www/auth.php
www/css/openid.css
www/www-header.php

index 154994adde15a1dd613178f441631c01dc722ff7..7e724b003d6e37f94b918d31f4a11b55a49dd22e 100644 (file)
   <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>
index 1cafd5934242e4c0095a40de30b8a760821d5245..29d7b37c26d9aaba4def0f5e766bd716899cbcbf 100644 (file)
@@ -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;
     }
index 38988a715094177b168bbfdfd7ecea1081941d26..296618bbea26f7f624fa8fc9b7c71519541e2a8c 100644 (file)
@@ -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%;
index 64dca1104a1810d1a0d91977e9c86e4e37e21ee8..96cd481829ac43a2e5c002d537253505f309269c 100644 (file)
@@ -1,6 +1,9 @@
 <?php
 namespace phorkie;
-session_start();
+if (session_id() == "") {
+    session_start();
+}
+
 set_include_path(
     __DIR__ . '/../src/'
     . PATH_SEPARATOR . get_include_path()