Skip to content

Commit

Permalink
[HOTFIX] Handle passport js error (#6580)
Browse files Browse the repository at this point in the history
* Handle errors on passportjs deserializeUser

* Bump patch version
  • Loading branch information
daneryl authored Mar 11, 2024
1 parent 45b5f8d commit b2b7497
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 9 deletions.
19 changes: 11 additions & 8 deletions app/api/auth/passport_conf.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,16 @@ passport.serializeUser((user, done) => {
});

passport.deserializeUser(async (serializeUser, done) => {
const currentTenant = tenants.current().name;
const [id, serializedTenant] = serializeUser.split('///');
if (serializedTenant !== currentTenant) {
return done(null, false);
try {
const currentTenant = tenants.current().name;
const [id, serializedTenant] = serializeUser.split('///');
if (serializedTenant !== currentTenant) {
return done(null, false);
}
const user = await users.getById(id, '-password', true);
appContext.set('user', user);
done(null, user);
} catch (e) {
done(e);
}

const user = await users.getById(id, '-password', true);
appContext.set('user', user);
done(null, user);
});
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "uwazi",
"version": "1.157.0",
"version": "1.157.1",
"description": "Uwazi is a free, open-source solution for organising, analysing and publishing your documents.",
"keywords": [
"react"
Expand Down

0 comments on commit b2b7497

Please sign in to comment.