Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Login with Ion Auth both Username and Email

I am using CodeIgniter. Now I have integrated Ion auth in CodeIgniter but I am facing the problem that how to log in with both Username and Email but ion auth accept only at a time with one identity to log in with Username OR Email. How to login with both username and email.

like image 705
Salman Iqbal Avatar asked May 20 '17 07:05

Salman Iqbal


1 Answers

You have first goto ion_auth_model and search login function in ion_auth_model and you will see this line.

$query = $this->db->select($this->identity_column .", ".$extraSelect.', email, id, password,active, last_login')

Add username into this line

$query = $this->db->select($this->identity_column .", ".$extraSelect.', username, email, id, password,active, last_login')

After this add or_where() clause

->where($this->identity_column, $identity)
->or_where('username',$identity)
->limit(1)
->order_by('id', 'desc')
->get($this->tables['users']);
like image 130
Shoukat Mirza Avatar answered Nov 16 '22 19:11

Shoukat Mirza