aboutsummaryrefslogtreecommitdiffstats
path: root/include/auth.php
diff options
context:
space:
mode:
authorFriendika <info@friendika.com>2010-11-17 17:03:27 -0800
committerFriendika <info@friendika.com>2010-11-17 17:03:27 -0800
commit875b31fb8efb5fbd5e6682321ac6a6a055cd8e4d (patch)
tree955b6de0e6b30ce5098d16d153d192ab51e7289d /include/auth.php
parent1d420e473f862898f05b9c6368b16fb9251fd85a (diff)
downloadvolse-hubzilla-875b31fb8efb5fbd5e6682321ac6a6a055cd8e4d.tar.gz
volse-hubzilla-875b31fb8efb5fbd5e6682321ac6a6a055cd8e4d.tar.bz2
volse-hubzilla-875b31fb8efb5fbd5e6682321ac6a6a055cd8e4d.zip
openid logins working
Diffstat (limited to 'include/auth.php')
-rw-r--r--include/auth.php30
1 files changed, 22 insertions, 8 deletions
diff --git a/include/auth.php b/include/auth.php
index 0a21a276a..c09a89ffb 100644
--- a/include/auth.php
+++ b/include/auth.php
@@ -67,16 +67,30 @@ else {
unset($_SESSION['page_flags']);
}
- if(x($_POST,'password'))
+ if((x($_POST,'password')) && strlen($_POST['password']))
$encrypted = hash('whirlpool',trim($_POST['password']));
else {
- if((x($_POST,'auth-params')) && $_POST['auth-params'] === 'login') {
- require_once('library/openid.php');
- $openid = new LightOpenID;
- $openid->identity = trim($_POST['login-name']);
- $a = get_app();
- $openid->returnUrl = $a->get_baseurl() . '/openid';
- goaway($openid->authUrl());
+ if((x($_POST,'login-name')) && strlen($_POST['login-name'])) {
+ $openid_url = trim($_POST['login-name']);
+ $r = q("SELECT `uid` FROM `user` WHERE `openid` = '%s' LIMIT 1",
+ dbesc($openid_url)
+ );
+ if(count($r)) {
+ require_once('library/openid.php');
+ $openid = new LightOpenID;
+ $openid->identity = $openid_url;
+ $_SESSION['openid'] = $openid_url;
+ $a = get_app();
+ $openid->returnUrl = $a->get_baseurl() . '/openid';
+ goaway($openid->authUrl());
+ // NOTREACHED
+ }
+ else {
+ $a = get_app();
+ notice( t('Login failed.') . EOL);
+ goaway($a->get_baseurl());
+ // NOTREACHED
+ }
}
}
if((x($_POST,'auth-params')) && $_POST['auth-params'] === 'login') {