aboutsummaryrefslogtreecommitdiffstats
path: root/mod/magic.php
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2013-12-02 15:15:02 -0800
committerfriendica <info@friendica.com>2013-12-02 15:15:02 -0800
commitd9f67876dce5da9ed056726f792e087d142699cb (patch)
tree4c615055a02508338f0992051bdafc5f773bb2b8 /mod/magic.php
parent3fdc3515b5dbfee4582467144d3c2d5eefc6a708 (diff)
downloadvolse-hubzilla-d9f67876dce5da9ed056726f792e087d142699cb.tar.gz
volse-hubzilla-d9f67876dce5da9ed056726f792e087d142699cb.tar.bz2
volse-hubzilla-d9f67876dce5da9ed056726f792e087d142699cb.zip
refactor magic-auth
Diffstat (limited to 'mod/magic.php')
-rw-r--r--mod/magic.php30
1 files changed, 5 insertions, 25 deletions
diff --git a/mod/magic.php b/mod/magic.php
index 6c8ad24ed..e3b14db62 100644
--- a/mod/magic.php
+++ b/mod/magic.php
@@ -91,8 +91,8 @@ function magic_init(&$a) {
if($rev)
goaway($dest);
else {
- logger('mod_magic: channel not found.' . print_r($_REQUEST,true));
- notice( t('Channel not found.') . EOL);
+ logger('mod_magic: no channels found for requested hub.' . print_r($_REQUEST,true));
+ notice( t('Hub not found.') . EOL);
return;
}
}
@@ -113,24 +113,9 @@ function magic_init(&$a) {
goaway($dest);
if($x[0]['hubloc_url'] === z_root()) {
- $webbie = substr($x[0]['hubloc_addr'],0,strpos('@',$x[0]['hubloc_addr']));
- switch($dest) {
- case 'channel':
- $desturl = z_root() . '/channel/' . $webbie;
- break;
- case 'photos':
- $desturl = z_root() . '/photos/' . $webbie;
- break;
- case 'profile':
- $desturl = z_root() . '/profile/' . $webbie;
- break;
- default:
- $desturl = $dest;
- break;
- }
// We are already authenticated on this site and a registered observer.
// Just redirect.
- goaway($desturl);
+ goaway($dest);
}
if(local_user()) {
@@ -142,20 +127,15 @@ function magic_init(&$a) {
$channel['token'] = $token;
$channel['token_sig'] = $token_sig;
-
- $recip = array(array('guid' => $x[0]['hubloc_guid'],'guid_sig' => $x[0]['hubloc_guid_sig']));
-
- $hash = random_string();
-
$r = q("insert into verify ( type, channel, token, meta, created) values ('%s','%d','%s','%s','%s')",
dbesc('auth'),
intval($channel['channel_id']),
dbesc($token),
- dbesc($x[0]['hubloc_hash']),
+ dbesc($x[0]['hubloc_url']),
dbesc(datetime_convert())
);
- $target_url = $x[0]['hubloc_callback'] . '/' . substr($x[0]['hubloc_addr'],0,strpos($x[0]['hubloc_addr'],'@')) ;
+ $target_url = $x[0]['hubloc_callback'];
logger('mod_magic: redirecting to: ' . $target_url, LOGGER_DEBUG);
goaway($target_url