about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--client/index.html18
-rw-r--r--client/src/Login.elm5
-rw-r--r--client/src/State.elm2
3 files changed, 23 insertions, 2 deletions
diff --git a/client/index.html b/client/index.html
index ce8f727b6f3b..facf4e98623c 100644
--- a/client/index.html
+++ b/client/index.html
@@ -2,13 +2,31 @@
 <html lang="en">
   <head>
     <meta charset="UTF-8" />
+    <meta name="google-signin-client_id" content="580018768696-4beppspj6cu7rhjnfgok8lbmh9a4n3ok.apps.googleusercontent.com">
     <title>Elm SPA</title>
     <link rel="stylesheet" href="./output.css" />
+    <script src="https://apis.google.com/js/platform.js" async defer></script>
     <script src="./Main.min.js"></script>
   </head>
   <body class="font-serif">
     <div id="mount"></div>
     <script>
+     function onSignIn(googleUser) {
+       var profile = googleUser.getBasicProfile();
+       console.log('ID: ' + profile.getId());
+       console.log('Name: ' + profile.getName());
+       console.log('Image URL: ' + profile.getImageUrl());
+       console.log('Email: ' + profile.getEmail());
+     }
+
+     function signOut() {
+       console.log('Signing out!');
+       var auth2 = gapi.auth2.getAuthInstance();
+       auth2.signOut().then(function() {
+         console.log('User signed out.');
+       });
+     }
+
      Elm.Main.init({node: document.getElementById("mount")});
     </script>
   </body>
diff --git a/client/src/Login.elm b/client/src/Login.elm
index 27f1d811a89a..968325d48cfe 100644
--- a/client/src/Login.elm
+++ b/client/src/Login.elm
@@ -5,9 +5,12 @@ import Html.Attributes exposing (..)
 import Html.Events exposing (..)
 import State
 
+googleSignIn : Html State.Msg
+googleSignIn =
+    div [ class "g-signin2", attribute "onsuccess" "onSignIn" ] []
 
 render : State.Model -> Html State.Msg
 render model =
     div [ class "pt-10 pb-20 px-10" ]
-        [ p [] [ text "Please authenticate" ]
+        [ googleSignIn
         ]
diff --git a/client/src/State.elm b/client/src/State.elm
index c1edae8bb638..8c56a7ecce1d 100644
--- a/client/src/State.elm
+++ b/client/src/State.elm
@@ -22,7 +22,7 @@ type alias Model =
 init : Model
 init =
     { isLoading = False
-    , view = Landing
+    , view = Login
     }