The controller code is just a basic example. The library won't allow you to have duplicate identities but the best way to check and notify the user of this is with form_validation callbacks.
Below are the two callbacks I usually use:
Code:
/**
* Username check
*
* @return bool
* @author Ben Edmunds
**/
public function username_check($username)
{
if ($this->ion_auth->username_check($username))
{
$this->form_validation->set_message('username_check', 'The username "'.$username.'" already exists.');
return FALSE;
}
else
{
return TRUE;
}
}
/**
* Email check
*
* @return bool
* @author Ben Edmunds
**/
public function email_check($email)
{
if ($this->ion_auth->email_check($email))
{
$this->form_validation->set_message('email_check', 'The email "'.$email.'" already exists.');
return FALSE;
}
else
{
return TRUE;
}
}