added email fixes

This commit is contained in:
Wyatt Johnson
2018-01-11 10:58:43 -07:00
parent 92b506c85a
commit 1dcf297a45
5 changed files with 42 additions and 28 deletions
+3 -3
View File
@@ -79,13 +79,13 @@ router.post('/:user_id/email/confirm', authorization.needed('ADMIN', 'MODERATOR'
}
// Find the first local profile.
let localProfile = user.profiles.find((profile) => profile.provider === 'local');
if (!localProfile) {
const email = user.firstEmail;
if (!email) {
return next(errors.ErrMissingEmail);
}
// Send the email to the first local profile that was found.
await UsersService.sendEmailConfirmation(user, localProfile.id);
await UsersService.sendEmailConfirmation(user, email);
res.status(204).end();
} catch (e) {