about summary refs log tree commit diff
path: root/client/src/State.elm
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-08-02T20·27+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-08-02T20·27+0100
commitb9ed4a2dc170a3a4b6c1095cdfc79e49292f315d (patch)
treedb81e5f3fb515d9d5ca8003968c11b6b09591a82 /client/src/State.elm
parentd6b91b93cbb42170249eb17eb7d0cb1c1a31f44a (diff)
Partially support federated login
Two things:
1. I've never attempted to support this before.
2. It seems surprisingly and perhaps deceptively simpler than what I
   expected. I'm unsure what to do once Google's API authenticates the user. I
   currently look-up the user's role, trips, etc. using their email address. The
   role is stored in the Accounts table alongside username, email, password. I
   will speak with the interviewer tomorrow about this.
Diffstat (limited to 'client/src/State.elm')
-rw-r--r--client/src/State.elm14
1 files changed, 14 insertions, 0 deletions
diff --git a/client/src/State.elm b/client/src/State.elm
index 110fb72a78ed..b3f78bb16980 100644
--- a/client/src/State.elm
+++ b/client/src/State.elm
@@ -43,6 +43,8 @@ type Msg
     | ClearErrors
     | ToggleLoginForm
     | PrintPage
+    | GoogleSignIn
+    | GoogleSignOut
     | UpdateInviteEmail String
     | UpdateInviteRole (Maybe Role)
     | ReceiveTodaysDate Date.Date
@@ -608,6 +610,12 @@ adminHome flags url key =
 port printPage : () -> Cmd msg
 
 
+port googleSignIn : () -> Cmd msg
+
+
+port googleSignOut : () -> Cmd msg
+
+
 {-| The initial state for the application.
 -}
 init : () -> Url.Url -> Nav.Key -> ( Model, Cmd Msg )
@@ -732,6 +740,12 @@ update msg model =
         PrintPage ->
             ( model, printPage () )
 
+        GoogleSignIn ->
+            ( model, googleSignIn () )
+
+        GoogleSignOut ->
+            ( model, googleSignOut () )
+
         UpdateInviteEmail x ->
             ( { model | inviteEmail = x }, Cmd.none )