mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-02-26 16:41:21 +01:00
remove email only login (#10030)
* feat: remove ACP option for email-only logins * feat: remove email-only login, upgrade script to fix config
This commit is contained in:
@@ -6,7 +6,6 @@
|
||||
"allow-login-with": "Allow login with",
|
||||
"allow-login-with.username-email": "Username or Email",
|
||||
"allow-login-with.username": "Username Only",
|
||||
"allow-login-with.email": "Email Only",
|
||||
"account-settings": "Account Settings",
|
||||
"gdpr_enabled": "Enable GDPR consent collection",
|
||||
"gdpr_enabled_help": "When enabled, all new registrants will be required to explicitly give consent for data collection and usage under the <a href=\"https://ec.europa.eu/info/priorities/justice-and-fundamental-rights/data-protection/2018-reform-eu-data-protection-rules/eu-data-protection-rules_en\">General Data Protection Regulation (GDPR)</a>. <strong>Note</strong>: Enabling GDPR does not force pre-existing users to provide consent. To do so, you will need to install the GDPR plugin.",
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"username-email": "Username / Email",
|
||||
"username": "Username",
|
||||
"email": "Email",
|
||||
"remember_me": "Remember Me?",
|
||||
"forgot_password": "Forgot Password?",
|
||||
"alternative_logins": "Alternative Logins",
|
||||
|
||||
@@ -130,9 +130,10 @@ Controllers.login = async function (req, res) {
|
||||
return helpers.redirect(res, { external: data.authentication[0].url });
|
||||
}
|
||||
|
||||
// Re-auth challenge, pre-fill username
|
||||
if (req.loggedIn) {
|
||||
const userData = await user.getUserFields(req.uid, ['username', 'email']);
|
||||
data.username = allowLoginWith === 'email' ? userData.email : userData.username;
|
||||
const userData = await user.getUserFields(req.uid, ['username']);
|
||||
data.username = userData.username;
|
||||
data.alternate_logins = false;
|
||||
}
|
||||
res.render('login', data);
|
||||
|
||||
16
src/upgrades/1.19.0/reenable-username-login.js
Normal file
16
src/upgrades/1.19.0/reenable-username-login.js
Normal file
@@ -0,0 +1,16 @@
|
||||
'use strict';
|
||||
|
||||
const db = require('../../database');
|
||||
const meta = require('../../meta');
|
||||
|
||||
module.exports = {
|
||||
name: 'Re-enable username login',
|
||||
timestamp: Date.UTC(2021, 10, 23),
|
||||
method: async () => {
|
||||
const setting = await meta.config.allowLoginWith;
|
||||
|
||||
if (setting === 'email') {
|
||||
await meta.configs.set('allowLoginWith', 'username-email');
|
||||
}
|
||||
},
|
||||
};
|
||||
@@ -16,7 +16,6 @@
|
||||
<select id="allowLoginWith" class="form-control" data-field="allowLoginWith">
|
||||
<option value="username-email">[[admin/settings/user:allow-login-with.username-email]]</option>
|
||||
<option value="username">[[admin/settings/user:allow-login-with.username]]</option>
|
||||
<option value="email">[[admin/settings/user:allow-login-with.email]]</option>
|
||||
</select>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
Reference in New Issue
Block a user