diff options
author | Andrew Manning <tamanning@zoho.com> | 2016-07-16 21:04:04 -0400 |
---|---|---|
committer | Andrew Manning <tamanning@zoho.com> | 2016-07-16 21:04:04 -0400 |
commit | 99354ac57622002c0bbd820235d03321406f8d39 (patch) | |
tree | f8ad698a1c901f757dfc4354721846c8be82ab7e /include/security.php | |
parent | e7b853175154688d60d83ca5935650d1128973c6 (diff) | |
parent | f396b1bf735a7dc9eb3632e49c1269de54777c6d (diff) | |
download | volse-hubzilla-99354ac57622002c0bbd820235d03321406f8d39.tar.gz volse-hubzilla-99354ac57622002c0bbd820235d03321406f8d39.tar.bz2 volse-hubzilla-99354ac57622002c0bbd820235d03321406f8d39.zip |
Merge remote-tracking branch 'upstream/dev' into website-import-remote
Diffstat (limited to 'include/security.php')
-rw-r--r-- | include/security.php | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/include/security.php b/include/security.php index 212690d91..e345636e7 100644 --- a/include/security.php +++ b/include/security.php @@ -82,6 +82,44 @@ function authenticate_success($user_record, $login_initial = false, $interactive /* else just return */ } +function atoken_login($atoken) { + if(! $atoken) + return false; + + $xchan = atoken_xchan($atoken); + + $_SESSION['authenticated'] = 1; + $_SESSION['visitor_id'] = $xchan['xchan_hash']; + $_SESSION['atoken'] = $atoken['atoken_id']; + + \App::set_observer($xchan); + + return [ 'atoken' => true ]; +} + + +function atoken_xchan($atoken) { + + $c = channelx_by_n($atoken['atoken_uid']); + if($c) { + return [ + 'xchan_hash' => substr($c['channel_hash'],0,16) . '.' . $atoken['atoken_name'], + 'xchan_name' => $atoken['atoken_name'], + 'xchan_addr' => t('guest:') . $atoken['atoken_name'] . '@' . \App::get_hostname(), + 'xchan_network' => 'unknown', + 'xchan_hidden' => 1, + 'xchan_photo_mimetype' => 'image/jpeg', + 'xchan_photo_l' => get_default_profile_photo(300), + 'xchan_photo_m' => get_default_profile_photo(80), + 'xchan_photo_s' => get_default_profile_photo(48) + + ]; + } + +} + + + /** * @brief Change to another channel with current logged-in account. * |