Browse Source

check for empty "me" parameter

pull/5/head
Aaron Parecki 10 years ago
parent
commit
9b040151e6
2 changed files with 5 additions and 2 deletions
  1. +4
    -1
      controllers/auth.php
  2. +1
    -1
      views/auth_error.php

+ 4
- 1
controllers/auth.php View File

@ -27,6 +27,9 @@ function build_url($parsed_url) {
function normalizeMeURL($url) { function normalizeMeURL($url) {
$me = parse_url($url); $me = parse_url($url);
if(array_key_exists('path', $me) && $me['path'] == '')
return false;
// parse_url returns just "path" for naked domains // parse_url returns just "path" for naked domains
if(count($me) == 1 && array_key_exists('path', $me)) { if(count($me) == 1 && array_key_exists('path', $me)) {
$me['host'] = $me['path']; $me['host'] = $me['path'];
@ -79,7 +82,7 @@ $app->get('/auth/start', function() use($app) {
$html = render('auth_error', array( $html = render('auth_error', array(
'title' => 'Sign In', 'title' => 'Sign In',
'error' => 'Invalid "me" Parameter', 'error' => 'Invalid "me" Parameter',
'errorDescription' => 'The ID you entered, <strong>' . $params['me'] . '</strong> is not valid.'
'errorDescription' => 'The URL you entered, "<strong>' . $params['me'] . '</strong>" is not valid.'
)); ));
$app->response()->body($html); $app->response()->body($html);
return; return;

+ 1
- 1
views/auth_error.php View File

@ -5,4 +5,4 @@
<p><?= $this->errorDescription ?></p> <p><?= $this->errorDescription ?></p>
<?div>
</div>

Loading…
Cancel
Save