[eluser]ChrisMiller[/eluser]
[quote author="Phil Sturgeon" date="1279547626"]
[quote author="Timothy_" date="1279534680"]
I would like people to be able to log in with either their email address OR their user-name.
I looked at the code to see if there was any scope for this and wasn't able to find anything that indicates that Ion Auth lets you authenticate on both fields.
Is there an option for this that I have missed or is there room for this in the future.
Thanks
Tim[/quote]
Sorry dude it's set up to work with one OR the other. It shouldn't be too tough to modify the model to get this working. If you can think of an implementation that doesn't break current functionality then me or Ben will be happy to put it into Ion Auth. GitHub fork FTW.[/quote]
Just a thought here but what about in the model we check to see if the identity is a valid email or just a string and then choose the appropriate table row...
Code:
public function login($identity, $password, $remember=FALSE)
{
if (empty($identity) || empty($password) )
{
return FALSE;
}
// Only One Login Type Enabled
$this->db
->select($this->identity_column.', id, password, group_id')
->where($this->identity_column, $identity);
}
[ Rest of Function... ]
}
Obviously the Example adds a new Config Item so you can configure if they want to enable people to use emails and usernames to login depending on what they perfer.