Skip to content

Commit

Permalink
auth: sanitize user for subsequent external logins
Browse files Browse the repository at this point in the history
fixes #706
  • Loading branch information
tahini committed Sep 1, 2023
1 parent 83ecb3b commit c77ce46
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/chaire-lib-backend/src/config/auth/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export default <U extends IUserModel>(authModel: IAuthModel<U>): PassportStatic
.then(async (user) => {
if (user !== undefined) {
// TODO Should sanitize user, but see if other fields need to be included
done(null, { ...user });
done(null, user.sanitize());
} else {
const newUser = await authModel.createAndSave({ googleId: profile.id, isTest: false });
done(null, newUser !== null ? newUser.sanitize() : false);
Expand Down Expand Up @@ -58,7 +58,7 @@ export default <U extends IUserModel>(authModel: IAuthModel<U>): PassportStatic
.then(async (user) => {
if (user !== undefined) {
// TODO Should sanitize user, but see if other fields need to be included
done(null, { ...user });
done(null, user.sanitize());
} else {
const newUser = await authModel.createAndSave({
facebookId: profile.id,
Expand Down

0 comments on commit c77ce46

Please sign in to comment.