我可以通过用户名或电子邮件设置Ion auth登录 [英] Can I set Ion auth to login by username OR Email

查看:299
本文介绍了我可以通过用户名或电子邮件设置Ion auth登录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我可以设置离开auth登录的用户名在配置,我也知道我可以设置它通过电子邮件在配置中登录。

I know I can set ion auth to login by username in the config, I also know I can set it to login by email in the config.

有没有简单的方法来设置它自动使用?

Is there a simple way to set it it to use either automatically?

推荐答案

如果是自动的,你的意思是尝试一个然后另一个看看是否给出一个有效的回报:

If by automatic, you mean try one and then the other to see if either gives a valid return:

登录发生在ion_auth_model行:899



The login occurs in ion_auth_model line: 899

->where($this->identity_column, $this->db->escape_str($identity))

,所以你可以改变这做一个或,并尝试两列。你需要在整个模型中这样做,因为不仅仅是实际登录要考虑&有一个潜在的问题,用户有一个电子邮件是另一个用户的用户名(不太可能)

so you could change this to do an "or" and try both columns. You would need to do this throughout the model because there is more than just the actual login to consider & there's the potential issue of a user having an email that is another user's username (however unlikely)

这篇关于我可以通过用户名或电子邮件设置Ion auth登录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆