remove email only login (#10030)

* feat: remove ACP option for email-only logins

* feat: remove email-only login, upgrade script to fix config
isekai-main
Julian Lam 3 years ago committed by GitHub
parent 79de48c57f
commit 01bd8a8694
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -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);

@ -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>

Loading…
Cancel
Save