Skip to content

Commit

Permalink
Merge pull request #157 from ufabc-next/hotfix/login-facebook
Browse files Browse the repository at this point in the history
Hotfix/login facebook
  • Loading branch information
brMonteiro-G authored Nov 16, 2023
2 parents a238d17 + 63563cf commit 7ba5eb8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 1 deletion.
14 changes: 14 additions & 0 deletions app/api/facebook/func.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
const app = require('@/app')

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

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

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

return null
}
5 changes: 5 additions & 0 deletions app/api/facebook/route.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
const app = require('@/app')

module.exports = async (router) => {
router.post('/facebook/sync', app.helpers.routes.func(require('./func.js')))
}
2 changes: 1 addition & 1 deletion app/setup/oauth.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,4 +121,4 @@ async function google(context) {
? `ufabcnext://login?token=${await user.generateJWT()}&`
:`${WEB_URL}/login?token=${user.generateJWT()}`
}
}
}

0 comments on commit 7ba5eb8

Please sign in to comment.