Allow password reset emails to be sent to social login users

This commit is contained in:
Phillip Thelen
2021-11-11 12:57:39 +01:00
parent b18bcc64f3
commit 5aa924f02f
2 changed files with 15 additions and 9 deletions
+8 -1
View File
@@ -341,7 +341,14 @@ api.resetPassword = {
if (validationErrors) throw validationErrors;
const email = req.body.email.toLowerCase();
const user = await User.findOne({ 'auth.local.email': email }).exec();
const user = await User.findOne({
$or: [
{ 'auth.local.email': email },
{ 'auth.apple.emails.value': email },
{ 'auth.google.emails.value': email },
{ 'auth.facebook.emails.value': email },
],
}).exec();
if (user) {
// create an encrypted link to be used to reset the password