Skip to content

Commit

Permalink
Fix sign in flow (#129)
Browse files Browse the repository at this point in the history
Accidentally broke this when adding the 'Home' view.
  • Loading branch information
frankieroberto authored Oct 15, 2024
1 parent 4543017 commit 3a5707f
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
13 changes: 11 additions & 2 deletions app/routes/auth.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,15 @@ module.exports = router => {

})

router.get('/sign-in-as-single-org-user', (req ,res) => {

// Set organisation and user Id
req.session.data.currentOrganisationId = req.session.data.organisations[1].id
req.session.data.currentUserId = "12345";

res.redirect('/home')
})

router.post('/select-organisation', (req, res) => {
const organisationId = req.session.data.organisationId

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

res.redirect('/find-a-patient')
res.redirect('/home')
} else {

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

res.redirect('/home')
res.redirect('/signed-out')
})

}
4 changes: 2 additions & 2 deletions app/views/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ <h1>

<h2>Main interface</h2>

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

<ul>
<li><a href="/vaccines">Vaccines</a></li>
Expand Down
2 changes: 1 addition & 1 deletion app/views/okta-sign-in.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
{{ button({
classes: "app-button--okta nhsuk-u-margin-top-5",
text: "Sign in",
href: ("/select-organisation" if data.multiOrganisation == "yes" else "/find-a-patient")
href: ("/select-organisation" if data.multiOrganisation == "yes" else "/sign-in-as-single-org-user")
}) }}

</div></form></div><div class="siw-main-footer"><div class="auth-footer"></div></div></div></div></div></main></div>
Expand Down
File renamed without changes.

0 comments on commit 3a5707f

Please sign in to comment.