]> git.mxchange.org Git - quix0rs-gnu-social.git/commitdiff
Fix: Cannot remove OpenID
authorChimo <chimo@chromic.org>
Wed, 24 Feb 2016 17:42:41 +0000 (12:42 -0500)
committerChimo <chimo@chromic.org>
Wed, 24 Feb 2016 17:42:41 +0000 (12:42 -0500)
OpenidsettingsAction::removeOpenID() was comparing and int with a string
so always displayed "That OpenID does not belong to you."

plugins/OpenID/actions/openidsettings.php
plugins/OpenID/classes/User_openid.php

index bf5d8886f179a0fee2be3d6670047a100ad2da0d..75835ff1f1be83a840ffa8a9c9ebb1f12dc64c32 100644 (file)
@@ -287,7 +287,7 @@ class OpenidsettingsAction extends SettingsAction
             // TRANS: Form validation error for a non-existing OpenID.
             throw new ClientException(_m('No such OpenID.'));
         }
-        if ($this->scoped->getID() !== $oid->user_id) {
+        if ($this->scoped->getID() !== $oid->getID()) {
             // TRANS: Form validation error if OpenID is connected to another user.
             throw new ClientException(_m('That OpenID does not belong to you.'));
         }
index 7e53d8ec959893f1dd80ac5724f91175d0765e29..2221a9e78aeb08f579071f039286a1ccbae6a8ec 100644 (file)
@@ -45,6 +45,16 @@ class User_openid extends Managed_DataObject
         );
     }
 
+    public function getID()
+    {
+        if (!isset($this->user_id)) {
+            throw new Exception('No ID set.');
+        } elseif (empty($this->user_id)) {
+            throw new Exception('Empty ID for object! (not inserted yet?).');
+        }
+        return intval($this->user_id);
+    }
+
     static function hasOpenID($user_id)
     {
         $oid = new User_openid();