X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ffinishimmediate.php;h=0964c39f44007d14208402cb4baca696e9399448;hb=bc15d027a804e60e76bdaf6fd47e69d41b395e7e;hp=af55f166ef8cd989ece14d1c1461bf4fe31536fc;hpb=171b4f72ee5a84d2a67b99aca7df9406e68f60c1;p=quix0rs-gnu-social.git diff --git a/actions/finishimmediate.php b/actions/finishimmediate.php index af55f166ef..0964c39f44 100644 --- a/actions/finishimmediate.php +++ b/actions/finishimmediate.php @@ -21,44 +21,48 @@ if (!defined('LACONICA')) { exit(1); } require_once(INSTALLDIR.'/lib/openid.php'); -class FinishimmediateAction extends Action { +class FinishimmediateAction extends Action +{ - function handle($args) { - parent::handle($args); - - $consumer = oid_consumer(); + function handle($args) + { + parent::handle($args); - $response = $consumer->complete(common_local_url('finishimmediate')); + $consumer = oid_consumer(); - if ($response->status == Auth_OpenID_SUCCESS) { - $display = $response->getDisplayIdentifier(); - $canonical = ($response->endpoint->canonicalID) ? - $response->endpoint->canonicalID : $response->getDisplayIdentifier(); + $response = $consumer->complete(common_local_url('finishimmediate')); - $user = $this->get_user($canonical); - - if ($user) { - $this->update_user($user, $sreg); - common_set_user($user->nickname); - $this->go_backto(); - return; - } - } + if ($response->status == Auth_OpenID_SUCCESS) { + $display = $response->getDisplayIdentifier(); + $canonical = ($response->endpoint->canonicalID) ? + $response->endpoint->canonicalID : $response->getDisplayIdentifier(); - # Failure! Clear openid so we don't try it again - - oid_clear_last(); - $this->go_backto(); - return; - } - - function go_backto() { - common_ensure_session(); - $backto = $_SESSION['openid_immediate_backto']; - if (!$backto) { - # gar. Well, push them to the public page - $backto = common_local_url('public'); - } - common_redirect($backto); - } + $user = oid_get_user($canonical); + + if ($user) { + oid_update_user($user, $sreg); + oid_set_last($display); # refresh for another year + common_set_user($user->nickname); + $this->go_backto(); + return; + } + } + + # Failure! Clear openid so we don't try it again + + oid_clear_last(); + $this->go_backto(); + return; + } + + function go_backto() + { + common_ensure_session(); + $backto = $_SESSION['openid_immediate_backto']; + if (!$backto) { + # gar. Well, push them to the public page + $backto = common_local_url('public'); + } + common_redirect($backto); + } }