How do I set email as username in Joomla 3.x?

谁说胖子不能爱 提交于 2019-12-11 01:00:18

问题


I managed to edit most of the registration form by adding fields to the database and tweaking the xml files and the php files. I even found a free plugin that allows login with an email and not the username.

But I can't figure out a way to remove the username entirely. or at least remove it from the form and creating an automatic username (that the user doesn't even really needs to see ever)

I'm well aware of the Email as Username plugin but hope I can do it without it.


回答1:


So this is going to be a bit tricky. Joomla doesn't allow the email to be passed to the authentication plugin so you are going to have to proxy it through the username field.

On the site, I'd create a new login module that simply changed the label of the username field to "Email". You still need to keep the name of the field as username.

Then, in the Joomla Authentication plugin, see https://github.com/joomla/joomla-cms/blob/master/plugins/authentication/joomla/joomla.php#L50

try changing that line to:

->where('email=' . $db->quote($credentials['username']));

Just try that hack for now and see if it works. If it does all you need to do is copy that plugin, with the modification, and rename it to something else (remember to restore the old code in the original plugin). Let me know how you go.



来源:https://stackoverflow.com/questions/20552383/how-do-i-set-email-as-username-in-joomla-3-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!