Skip to content

Commit

Permalink
Merge pull request #111 from ufabc-next/hotfix/facebook-auth
Browse files Browse the repository at this point in the history
hotfix: facebook auth
  • Loading branch information
mateusbrg authored Jan 30, 2025
2 parents d77adf5 + b3aae5d commit 426eb7f
Showing 1 changed file with 26 additions and 26 deletions.
52 changes: 26 additions & 26 deletions apps/core/src/routes/users/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,32 +43,32 @@ const plugin: FastifyPluginAsyncZodOpenApi = async (app) => {
return userInfo;
});

app.post(
'/facebook',
{ schema: loginFacebookSchema },
async (request, reply) => {
const user = await UserModel.findOne({
ra: request.body.ra,
'oauth.emailFacebook': request.body.email,
});

if (!user) {
return reply.notFound('User not found');
}

const jwtToken = app.jwt.sign(
{
studentId: user._id.toJSON(),
active: user.active,
confirmed: user.confirmed,
email: user.email,
},
{ expiresIn: '2d' },
);

return { success: true, token: jwtToken };
},
);
// app.post(
// '/facebook',
// { schema: loginFacebookSchema },
// async (request, reply) => {
// const user = await UserModel.findOne({
// ra: request.body.ra,
// 'oauth.emailFacebook': request.body.email,
// });

// if (!user) {
// return reply.notFound('User not found');
// }

// const jwtToken = app.jwt.sign(
// {
// studentId: user._id.toJSON(),
// active: user.active,
// confirmed: user.confirmed,
// email: user.email,
// },
// { expiresIn: '2d' },
// );

// return { success: true, token: jwtToken };
// },
// );

app.post('/resend', { schema: resendEmailSchema }, async (request, reply) => {
const user = await UserModel.findOne({
Expand Down

0 comments on commit 426eb7f

Please sign in to comment.