From 5b0cc776ae85cd68dee0da87302c4e3b180a5357 Mon Sep 17 00:00:00 2001 From: LLLL Colonq Date: Mon, 18 Nov 2024 06:18:25 -0500 Subject: Nicer errors, actually redirect --- main.css | 9 ++++++++- src/Auth.js | 2 ++ src/Main.purs | 6 ++++-- templates/auth/index.html | 3 +++ 4 files changed, 17 insertions(+), 3 deletions(-) diff --git a/main.css b/main.css index ccef777..b173959 100644 --- a/main.css +++ b/main.css @@ -322,7 +322,7 @@ a.lcolonq-button-link :active { display: grid; width: 100%; height: 100%; - grid-template-rows: 1fr 1fr 1fr; + grid-template-rows: 1fr 1fr 1fr 1fr; grid-template-columns: 1fr 2fr 1fr; } @@ -341,3 +341,10 @@ a.lcolonq-button-link :active { #lcolonq-auth-submit { display: none; } + +#lcolonq-auth-error { + grid-row: 3; + grid-column: 2; + text-align: center; + color: red; +} diff --git a/src/Auth.js b/src/Auth.js index 246052c..3c077ce 100644 --- a/src/Auth.js +++ b/src/Auth.js @@ -50,6 +50,8 @@ export const _clearSessionCookie = () => { }; export const _getRedirect = (Just) => (Nothing) => (x) => () => { + const data = x["data"]; + if (!data) return Nothing; const r = x["data"]["redirect"]; if (r) return Just(r); return Nothing; diff --git a/src/Main.purs b/src/Main.purs index af89f35..7897b49 100644 --- a/src/Main.purs +++ b/src/Main.purs @@ -248,8 +248,10 @@ mainAuth = launchAff_ do } res <- resp getRedirect res >>= case _ of - Nothing -> liftEffect $ log "failed" - Just r -> liftEffect $ log $ "redirect: " <> r + Nothing -> do + err <- byId "lcolonq-auth-error" + removeClass "lcolonq-invisible" err + Just r -> UI.redirect r main :: Effect Unit main = case Config.mode of diff --git a/templates/auth/index.html b/templates/auth/index.html index 7b5cc03..a67d2fe 100644 --- a/templates/auth/index.html +++ b/templates/auth/index.html @@ -28,6 +28,9 @@ CONFIG_SUBST +
+ login failed. either you used the wrong credentials or something is messed up on my end :3 +
-- cgit v1.2.3