Merge branch 'remove-openid' into 'nightly'

Fix: Cannot remove OpenID

OpenidsettingsAction::removeOpenID() was comparing and int with a string
so always displayed "That OpenID does not belong to you."

See merge request !107
This commit is contained in:
mmn 2016-02-26 12:30:01 +00:00
commit d500fb8598
2 changed files with 11 additions and 1 deletions

View File

@ -287,7 +287,7 @@ class OpenidsettingsAction extends SettingsAction
// TRANS: Form validation error for a non-existing OpenID. // TRANS: Form validation error for a non-existing OpenID.
throw new ClientException(_m('No such 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. // TRANS: Form validation error if OpenID is connected to another user.
throw new ClientException(_m('That OpenID does not belong to you.')); throw new ClientException(_m('That OpenID does not belong to you.'));
} }

View 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) static function hasOpenID($user_id)
{ {
$oid = new User_openid(); $oid = new User_openid();