如何在 Joomla 3.x 中将电子邮件设置为用户名? [英] How do I set email as username in Joomla 3.x?

查看:11
本文介绍了如何在 Joomla 3.x 中将电子邮件设置为用户名?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过向数据库添加字段并调整 xml 文件和 php 文件,我设法编辑了大部分注册表单.我什至找到了一个允许使用电子邮件而不是用户名登录的免费插件.

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.

推荐答案

所以这会有点棘手.Joomla 不允许将电子邮件传递给身份验证插件,因此您必须通过 username 字段代理它.

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.

在站点上,我将创建一个新的登录模块,只需将 username 字段的标签更改为电子邮件".您仍然需要将字段名称保留为 username.

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.

然后,在 Joomla Authentication 插件中,查看 https://github.com/joomla/joomla-cms/blob/master/plugins/authentication/joomla/joomla.php#L50

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

尝试将该行更改为:

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

现在就试试这个 hack,看看它是否有效.如果它完成了所有您需要做的就是复制该插件,并进行修改,并将其重命名为其他名称(请记住恢复原始插件中的旧代码).让我知道你的进展情况.

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.

这篇关于如何在 Joomla 3.x 中将电子邮件设置为用户名?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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