Skip to content

Commit 3a5707f

Browse files
Fix sign in flow (#129)
Accidentally broke this when adding the 'Home' view.
1 parent 4543017 commit 3a5707f

File tree

4 files changed

+14
-5
lines changed

4 files changed

+14
-5
lines changed

app/routes/auth.js

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,15 @@ module.exports = router => {
1010

1111
})
1212

13+
router.get('/sign-in-as-single-org-user', (req ,res) => {
14+
15+
// Set organisation and user Id
16+
req.session.data.currentOrganisationId = req.session.data.organisations[1].id
17+
req.session.data.currentUserId = "12345";
18+
19+
res.redirect('/home')
20+
})
21+
1322
router.post('/select-organisation', (req, res) => {
1423
const organisationId = req.session.data.organisationId
1524

@@ -21,7 +30,7 @@ module.exports = router => {
2130
delete req.session.data.organisationId
2231
req.session.data.multiOrganisation = "no"
2332

24-
res.redirect('/find-a-patient')
33+
res.redirect('/home')
2534
} else {
2635

2736
const error = {
@@ -41,7 +50,7 @@ module.exports = router => {
4150
router.get('/sign-out', (req, res) => {
4251
req.session.data.currentUserId = null
4352

44-
res.redirect('/home')
53+
res.redirect('/signed-out')
4554
})
4655

4756
}

app/views/index.html

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ <h1>
3333

3434
<h2>Main interface</h2>
3535

36-
<p><a href="/home">Homepage</a></p>
37-
<p><a href="/home?multiOrganisation=yes">Homepage - sign in as a user belonging to 2 organisations</a></p>
36+
<p><a href="/signed-out">Signed out page</a></p>
37+
<p><a href="/signed-out?multiOrganisation=yes">Signed out page - sign in as a user belonging to 2 organisations</a></p>
3838

3939
<ul>
4040
<li><a href="/vaccines">Vaccines</a></li>

app/views/okta-sign-in.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
{{ button({
2424
classes: "app-button--okta nhsuk-u-margin-top-5",
2525
text: "Sign in",
26-
href: ("/select-organisation" if data.multiOrganisation == "yes" else "/find-a-patient")
26+
href: ("/select-organisation" if data.multiOrganisation == "yes" else "/sign-in-as-single-org-user")
2727
}) }}
2828

2929
</div></form></div><div class="siw-main-footer"><div class="auth-footer"></div></div></div></div></div></main></div>

0 commit comments

Comments
 (0)