diff options
| author | LLLL Colonq <llll@colonq> | 2024-11-26 04:13:31 -0500 |
|---|---|---|
| committer | LLLL Colonq <llll@colonq> | 2024-11-26 04:13:31 -0500 |
| commit | d5ffc77a120b304d98dbd31b3272bcd312334385 (patch) | |
| tree | 2a4f2cbebe503bbea4fda131f704ef21042b7ac9 /src/Main.purs | |
| parent | f186a0bc9a56f12aaa0ae50d0e50c4be8d0f91c9 (diff) | |
Redirect URL on login page
Diffstat (limited to 'src/Main.purs')
| -rw-r--r-- | src/Main.purs | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/src/Main.purs b/src/Main.purs index 983a805..c4b4fa5 100644 --- a/src/Main.purs +++ b/src/Main.purs @@ -3,7 +3,7 @@ module Main where import Prelude import Audio as Audio -import Auth (AuthInfo, authHeader, getToken, startTwitchAuth, clearSessionCookie, getRedirect) +import Auth (AuthInfo, authHeader, getToken, startTwitchAuth, clearSessionCookie, getQueryRedirect, getResponseRedirect) import Config as Config import Data.String as String import Data.Array (head) @@ -248,13 +248,20 @@ mainAuth = launchAff_ do passwordInp <- byId "lcolonq-auth-password" username <- getValue usernameInp password <- getValue passwordInp + rd <- getQueryRedirect { json: resp } <- fetch "/api/firstfactor" { method: POST , headers: { "Content-Type": "application/json" } - , body: UI.toJSON { username, password } + , body: UI.toJSON + { username + , password + , targetURL: case rd of + Just r -> r + Nothing -> "https://secure.colonq.computer" + } } res <- resp - getRedirect res >>= case _ of + getResponseRedirect res >>= case _ of Nothing -> do err <- byId "lcolonq-auth-error" removeClass "lcolonq-invisible" err |
