Revert "Revert "Prerequisites to removing Facebook authentication (#13683)""

This reverts commit b3c466ad5a.
This commit is contained in:
SabreCat
2022-01-27 14:50:04 -06:00
parent e687140cfc
commit e3ffd7acbc
12 changed files with 288 additions and 72 deletions

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