ReviewOS

also looking at this

stacks/reportshq

fix(auth): send people to their reports, and make a dead redirect fail the build

#34
Merged glennmichael123 wants to merge fix/auth-redirects into main
5 files +59 -16
resources/views/login.stxmodified+3-3
Changes to resources/views/login.stx
@@ -3,7 +3,7 @@
33//
44// The one page in the app that must render for a stranger, so it carries no
55// AuthGuard and no app chrome. It does the opposite check instead: somebody who
6// already has a session is sent to their projects rather than shown a form
6// already has a session is sent to their reports rather than shown a form
77// asking them to do something they have already done.
88import { sessionCookieName, sessionFrom } from '../../app/Support/session'
99
@@ -17,7 +17,7 @@ const signedIn = session.user !== null
1717 {{-- Already signed in: bounce before anything paints, the same way the
1818 guard does in the other direction. --}}
1919 @if (signedIn)
20 <script>window.location.replace('/projects')</script>
20 <script>window.location.replace('/reports')</script>
2121 @endif
2222
2323 <script>document.documentElement.setAttribute('data-session-cookie', {{ cookieName }})</script>
@@ -121,7 +121,7 @@ const signedIn = session.user !== null
121121 if (res.ok) {
122122 // replace, not assign: the back button should not return to a sign-in
123123 // form the person has already used.
124 window.location.replace('/projects')
124 window.location.replace('/reports')
125125 return
126126 }
127127