summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLLLL Colonq <llll@colonq>2024-11-18 06:18:25 -0500
committerLLLL Colonq <llll@colonq>2024-11-18 06:18:25 -0500
commit5b0cc776ae85cd68dee0da87302c4e3b180a5357 (patch)
tree62d237a0e4e9c45dbec86c438dadbe7980b38184
parent8b635c5d44dc8841850a5bba21ded3bd443d22b9 (diff)
Nicer errors, actually redirect
-rw-r--r--main.css9
-rw-r--r--src/Auth.js2
-rw-r--r--src/Main.purs6
-rw-r--r--templates/auth/index.html3
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
<input id="lcolonq-auth-submit" type="submit" value="log in now!!">
</form>
</div>
+ <div id="lcolonq-auth-error">
+ login failed. either you used the wrong credentials or something is messed up on my end :3
+ </div>
</div>
</body>
</html>