Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Email address update field bug #8665

Closed
numanturle opened this issue Sep 21, 2020 · 0 comments
Closed

Email address update field bug #8665

numanturle opened this issue Sep 21, 2020 · 0 comments
Assignees
Labels
Milestone

Comments

@numanturle
Copy link

version: NodeBB v1.15.0-beta.23
git hash: ccddbb1

The e-mail is not trim in the profile update area, so multiple users can use the same e-mail.

socket.emit("user.changeUsernameEmail", {
    password: "THISPASSWORD",
    email: "EMAIL",
    uid: USER_ID
}, function(e) {
    console.log(e);
});

Output:

{message: "[[error:email-taken]]"}

socket.emit("user.changeUsernameEmail", {
    password: "THISPASSWORD",
    email: " EMAIL",
    uid: USER_ID
}, function(e) {
    console.log(e);
});

Output:

null

user

async function isEmailAvailable(data, uid) {
if (!data.email) {
return;
}
if (!utils.isEmailValid(data.email)) {
throw new Error('[[error:invalid-email]]');
}
const email = await User.getUserField(uid, 'email');
if (email === data.email) {
return;
}
const available = await User.email.available(data.email);
if (!available) {
throw new Error('[[error:email-taken]]');
}
}

@barisusakli barisusakli self-assigned this Sep 22, 2020
@barisusakli barisusakli added this to the 1.15.0 milestone Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants