diff options
| author | Justin J. Novack <jnovack@gmail.com> | 2012-09-17 15:30:15 -0400 |
|---|---|---|
| committer | Justin J. Novack <jnovack@gmail.com> | 2012-09-17 15:30:15 -0400 |
| commit | 13989a4e7cb4453225762dab6b5e5a7565b43df8 (patch) | |
| tree | 694b0c2ce9071ef66a08a62da31a42aed46d1e96 | |
| parent | b8b5759174c0734d6682502b4e1830334dd0df13 (diff) | |
| download | phorkie-13989a4e7cb4453225762dab6b5e5a7565b43df8.tar.gz phorkie-13989a4e7cb4453225762dab6b5e5a7565b43df8.zip | |
FIX: login - sreg/ax default, identifier renamed to openid_url
| -rw-r--r-- | data/templates/login.htm | 6 | ||||
| -rw-r--r-- | www/auth.php | 46 | ||||
| -rw-r--r-- | www/css/openid.css | 2 | ||||
| -rw-r--r-- | www/www-header.php | 5 |
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() |
