Skip to content

Commit

Permalink
fix: don't redirect if there is no viewer in case auth is disabled (#…
Browse files Browse the repository at this point in the history
…4547)

* fix(auth): only redirect if auth is enabled

* Add tests
  • Loading branch information
mikeldking authored Sep 7, 2024
1 parent c3a9537 commit db739e0
Showing 1 changed file with 1 addition and 5 deletions.
6 changes: 1 addition & 5 deletions app/src/pages/authenticatedRootLoader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,7 @@ export async function authenticatedRootLoader() {
{}
).toPromise();

if (!loaderData?.viewer) {
// Should never happen but just in case
return redirect("/login");
}
if (loaderData.viewer.passwordNeedsReset) {
if (loaderData?.viewer?.passwordNeedsReset) {
return redirect("/reset-password");
}
return loaderData;
Expand Down

0 comments on commit db739e0

Please sign in to comment.