Skip to content

Commit

Permalink
hotfix: facebook redirect
Browse files Browse the repository at this point in the history
  • Loading branch information
Joabesv committed Nov 17, 2023
1 parent 7ba5eb8 commit 1094714
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions app/api/facebook/func.js
Original file line number Diff line number Diff line change
@@ -1,14 +1,21 @@
const app = require('@/app')

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

const WEB_URL = app.config.WEB_URL

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

if (user) {
const { _id } = user
return { userId: _id }

if (!user) {
return {
error: user,
msg: 'User does not exist'
}
}

return null
return {
_redirect: `${WEB_URL}/login?token=${user.generateJWT()}`
}
}

0 comments on commit 1094714

Please sign in to comment.