Make sure no secondary email addresses are used for registration or when changing email address
This commit is contained in:
parent
bbf9ef8b3d
commit
46fda14e08
@ -93,9 +93,7 @@ class IDF_Form_Register extends Pluf_Form
|
|||||||
function clean_email()
|
function clean_email()
|
||||||
{
|
{
|
||||||
$this->cleaned_data['email'] = mb_strtolower(trim($this->cleaned_data['email']));
|
$this->cleaned_data['email'] = mb_strtolower(trim($this->cleaned_data['email']));
|
||||||
$guser = new Pluf_User();
|
if (Pluf::factory('IDF_EmailAddress')->get_user_for_email_address($this->cleaned_data['email']) != null) {
|
||||||
$sql = new Pluf_SQL('email=%s', $this->cleaned_data['email']);
|
|
||||||
if ($guser->getCount(array('filter' => $sql->gen())) > 0) {
|
|
||||||
throw new Pluf_Form_Invalid(sprintf(__('The email "%s" is already used. If you need, click on the help link to recover your password.'), $this->cleaned_data['email']));
|
throw new Pluf_Form_Invalid(sprintf(__('The email "%s" is already used. If you need, click on the help link to recover your password.'), $this->cleaned_data['email']));
|
||||||
}
|
}
|
||||||
return $this->cleaned_data['email'];
|
return $this->cleaned_data['email'];
|
||||||
|
@ -393,10 +393,8 @@ class IDF_Form_UserAccount extends Pluf_Form
|
|||||||
function clean_email()
|
function clean_email()
|
||||||
{
|
{
|
||||||
$this->cleaned_data['email'] = mb_strtolower(trim($this->cleaned_data['email']));
|
$this->cleaned_data['email'] = mb_strtolower(trim($this->cleaned_data['email']));
|
||||||
$guser = new Pluf_User();
|
$user = Pluf::factory('IDF_EmailAddress')->get_user_for_email_address($this->cleaned_data['email']);
|
||||||
$sql = new Pluf_SQL('email=%s AND id!=%s',
|
if ($user != null and $user->id != $this->user->id) {
|
||||||
array($this->cleaned_data['email'], $this->user->id));
|
|
||||||
if ($guser->getCount(array('filter' => $sql->gen())) > 0) {
|
|
||||||
throw new Pluf_Form_Invalid(sprintf(__('The email "%s" is already used.'), $this->cleaned_data['email']));
|
throw new Pluf_Form_Invalid(sprintf(__('The email "%s" is already used.'), $this->cleaned_data['email']));
|
||||||
}
|
}
|
||||||
return $this->cleaned_data['email'];
|
return $this->cleaned_data['email'];
|
||||||
|
Loading…
Reference in New Issue
Block a user