summaryrefslogtreecommitdiff
path: root/src/Main.purs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Main.purs')
-rw-r--r--src/Main.purs13
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