Skip to content

Commit

Permalink
Merge pull request #161 from ViniciussSantos/fix-recover
Browse files Browse the repository at this point in the history
fix: facebook recovery link and facebook login workaround
  • Loading branch information
Joabesv authored Jan 20, 2024
2 parents ba7dd8b + f774e2f commit dc429a3
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions app/api/facebook/func.js
Original file line number Diff line number Diff line change
@@ -1,15 +1,18 @@
const app = require('@/app')
const app = require("@/app");

module.exports = async (context) => {
const { ra, email } = context.body
const { ra, email } = context.body;

const user = await app.models.users.findOne({
ra,
$or: [{ "oauth.facebookEmail": email }, { "oauth.email": email }],
});

const user = await app.models.users.findOne({ ra, 'oauth.emailFacebook': email })

if (!user) {
throw new Error('User does not exists')
throw new Error("User does not exists");
}

return {
token: user.generateJWT()
}
}
token: user.generateJWT(),
};
};
2 changes: 1 addition & 1 deletion app/api/users/me/recover/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module.exports = async function (context) {
const payload = {
recipient: user.email,
body: {
recovery_facebook: `${RECOVERY_URL}/facebook?userId=${user._id}`,
recovery_facebook: "https://api.ufabcnext.com/facebook/sync",
recovery_google: `${RECOVERY_URL}/google?userId=${user._id}`,
},
};
Expand Down

0 comments on commit dc429a3

Please sign in to comment.