X-Git-Url: https://git.mxchange.org/?a=blobdiff_plain;f=actions%2Ffinishaddopenid.php;h=6a7bb3d2484cc703dea65e4948d725ec824581e5;hb=4a0b1a9ea9d288e42ac03c43ef904b0565a7087f;hp=bd9ecf7dd7356c626cc2a7f8176fe4e8a8142415;hpb=9eb05720a11d0cd3a55b9689067d13a1f00ba508;p=quix0rs-gnu-social.git diff --git a/actions/finishaddopenid.php b/actions/finishaddopenid.php index bd9ecf7dd7..6a7bb3d248 100644 --- a/actions/finishaddopenid.php +++ b/actions/finishaddopenid.php @@ -58,18 +58,19 @@ class FinishaddopenidAction extends Action { $sreg = $sreg_resp->contents(); } - $user = $this->get_user($canonical); + $other = $this->get_user($canonical); - if ($user) { + if ($other) { $this->message(_t('This OpenID is already associated with user "') . $user->nickname . _t('"')); } else { - $user = common_current_user(); - if (!$this->connect_user($user, $display, $canonical)) { + $cur = common_current_user(); + $result = oid_link_user($cur->id, $display, $canonical); + if (!$result) { $this->message(_t('Error connecting user')); return; } if ($sreg) { - if (!$this->update_user($user, $sreg)) { + if (!$this->update_user($cur, $sreg)) { $this->message(_t('Error updating profile')); return; } @@ -136,19 +137,4 @@ class FinishaddopenidAction extends Action { return true; } - - function connect_user($user, $display, $canonical) { - - $oid = new User_openid(); - $oid->display = $display; - $oid->canonical = $canonical; - $oid->user_id = $user->id; - $oid->created = DB_DataObject_Cast::dateTime(); - - common_debug('Saving ' . print_r($oid, TRUE), __FILE__); - - if (!$oid->insert()) { - return false; - } - } }