mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 16:46:12 +01:00
fix: closes #13317, fix email confirm for changing email
This commit is contained in:
@@ -83,7 +83,6 @@
|
|||||||
"email-confirmed": "Email Confirmed",
|
"email-confirmed": "Email Confirmed",
|
||||||
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
"email-confirmed-message": "Thank you for validating your email. Your account is now fully activated.",
|
||||||
"email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
|
"email-confirm-error-message": "There was a problem validating your email address. Perhaps the code was invalid or has expired.",
|
||||||
"email-confirm-error-message-already-validated": "Your email address was already validated.",
|
|
||||||
"email-confirm-sent": "Confirmation email sent.",
|
"email-confirm-sent": "Confirmation email sent.",
|
||||||
|
|
||||||
"none": "None",
|
"none": "None",
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ get:
|
|||||||
error:
|
error:
|
||||||
type: string
|
type: string
|
||||||
description: Translation key for client-side localisation
|
description: Translation key for client-side localisation
|
||||||
alreadyValidated:
|
|
||||||
type: boolean
|
|
||||||
description: set to true if the email was already validated
|
|
||||||
required:
|
required:
|
||||||
- title
|
- title
|
||||||
- $ref: ../../components/schemas/CommonProps.yaml#/CommonProps
|
- $ref: ../../components/schemas/CommonProps.yaml#/CommonProps
|
||||||
@@ -235,12 +235,6 @@ Controllers.confirmEmail = async (req, res) => {
|
|||||||
return renderPage();
|
return renderPage();
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
if (req.loggedIn) {
|
|
||||||
const emailValidated = await user.getUserField(req.uid, 'email:confirmed');
|
|
||||||
if (emailValidated) {
|
|
||||||
return renderPage({ alreadyValidated: true });
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await user.email.confirmByCode(req.params.code, req.session.id);
|
await user.email.confirmByCode(req.params.code, req.session.id);
|
||||||
if (req.session.registration) {
|
if (req.session.registration) {
|
||||||
// After confirmation, no need to send user back to email change form
|
// After confirmation, no need to send user back to email change form
|
||||||
|
|||||||
@@ -1,14 +1,9 @@
|
|||||||
{{{ if alreadyValidated }}}
|
|
||||||
<div class="alert alert-info">
|
|
||||||
<p>[[notifications:email-confirm-error-message-already-validated]]</p>
|
|
||||||
{{{ end }}}
|
|
||||||
|
|
||||||
{{{ if error }}}
|
{{{ if error }}}
|
||||||
<div class="alert alert-warning">
|
<div class="alert alert-warning">
|
||||||
<p>[[notifications:email-confirm-error-message]]</p>
|
<p>[[notifications:email-confirm-error-message]]</p>
|
||||||
{{{ end }}}
|
{{{ end }}}
|
||||||
|
|
||||||
{{{ if (!error && !alreadyValidated )}}}
|
{{{ if !error }}}
|
||||||
<div class="alert alert-success">
|
<div class="alert alert-success">
|
||||||
<strong>[[notifications:email-confirmed]]</strong>
|
<strong>[[notifications:email-confirmed]]</strong>
|
||||||
<p>[[notifications:email-confirmed-message]]</p>
|
<p>[[notifications:email-confirmed-message]]</p>
|
||||||
|
|||||||
Reference in New Issue
Block a user