Skip to content

Commit fee450d

Browse files
Bugfix for logging in as a multi-org user (#703)
1 parent b638049 commit fee450d

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

app/routes/auth.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ module.exports = router => {
5454

5555
} else if (organisationsUserIsAnAdminAt.length > 1) {
5656

57-
req.session.data.userId = user.id
57+
req.session.data.currentUserId = user.id
5858
res.redirect('/auth/select-mode')
5959

6060
} else {
@@ -88,15 +88,13 @@ module.exports = router => {
8888

8989
router.get('/auth/select-organisation', (req, res) => {
9090
const data = req.session.data
91-
const email = data.email
92-
const user = data.users.find((user) => user.email === email)
91+
const user = res.locals.currentUser
9392
const from = req.query.from
9493

9594
const userOrganisationIds = user.organisations.map((organisation) => organisation.id)
9695
const organisations = data.organisations.filter((organisation) => userOrganisationIds.includes(organisation.id) )
9796

9897
res.render('auth/select-organisation', {
99-
email,
10098
organisations,
10199
from
102100
})

0 commit comments

Comments
 (0)