-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: recovery email facebook link and facebook workaround
- Loading branch information
1 parent
ba7dd8b
commit f774e2f
Showing
2 changed files
with
12 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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(), | ||
}; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters