show error when openid is already registered
This commit is contained in:
parent
09cf21aa7e
commit
90ba326f85
@ -39,7 +39,7 @@
|
||||
|
||||
<p>
|
||||
<form method="post" action="<?php echo $formaction; ?>">
|
||||
<label for="openid"><?php echo T_('New OpenID'); ?></label>
|
||||
<label for="openid"><?php echo T_('New E-Mail or OpenID'); ?></label>
|
||||
<input type="text" id="openid" name="openid_identifier" size="20" />
|
||||
<button type="submit" name="action" value="registerOpenId">
|
||||
<?php echo T_('Register'); ?>
|
||||
|
@ -260,10 +260,21 @@ class SemanticScuttle_Service_OpenId extends SemanticScuttle_DbService
|
||||
* @param string $identifier OpenID identifier (URL)
|
||||
* @param string $email OpenID-delivered e-mail address of the user
|
||||
*
|
||||
* @return boolean True if it worked, false if not
|
||||
* @return void
|
||||
*
|
||||
* @throws SemanticScuttle_Exception When something goes wrong,
|
||||
* e.g. the OpenID is already registered
|
||||
*/
|
||||
public function register($uId, $identifier, $email = null)
|
||||
{
|
||||
if ($this->getId($identifier) !== null) {
|
||||
//already registered
|
||||
throw new SemanticScuttle_Exception_User(
|
||||
'OpenID already registered: ' . $identifier,
|
||||
21
|
||||
);
|
||||
}
|
||||
|
||||
//FIXME: use email when google-openid
|
||||
$query = 'INSERT INTO ' . $this->getTableName()
|
||||
. ' ' . $this->db->sql_build_array(
|
||||
@ -277,10 +288,7 @@ class SemanticScuttle_Service_OpenId extends SemanticScuttle_DbService
|
||||
GENERAL_ERROR, 'Could not register OpenID',
|
||||
'', __LINE__, __FILE__, $query, $this->db
|
||||
);
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user