aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/View
diff options
context:
space:
mode:
authorJoris2016-03-11 23:21:06 +0100
committerJoris2016-03-11 23:21:06 +0100
commit9d57e149fcb124a28813c56f83cf254eb92baa42 (patch)
treeb796c4fdc738006c07e65e01f4845adafe064d2a /src/client/elm/View
parent709d1cf587e92508ef73bca8e847cfa510c03069 (diff)
Don't use persona anymore, use email token to sign in
Diffstat (limited to 'src/client/elm/View')
-rw-r--r--src/client/elm/View/SignIn.elm54
1 files changed, 33 insertions, 21 deletions
diff --git a/src/client/elm/View/SignIn.elm b/src/client/elm/View/SignIn.elm
index c21c16c..908ab62 100644
--- a/src/client/elm/View/SignIn.elm
+++ b/src/client/elm/View/SignIn.elm
@@ -2,12 +2,14 @@ module View.SignIn
( renderSignIn
) where
-import Json.Decode as Json
-import Signal exposing (Address)
-
import Html as H exposing (..)
import Html.Attributes exposing (..)
import Html.Events exposing (..)
+import Signal exposing (Address)
+import Json.Decode as Json
+
+import Update exposing (..)
+import Update.SignIn exposing (..)
import Model exposing (Model)
import Model.Action exposing (..)
@@ -16,33 +18,43 @@ import Model.View.SignInView exposing (..)
import Model.Translations exposing (getMessage)
import View.Events exposing (onSubmitPrevDefault)
-import View.Icon exposing (..)
-
-import Persona exposing (operations)
+import View.Icon exposing (renderSpinIcon)
renderSignIn : Address Action -> Model -> SignInView -> Html
renderSignIn address model signInView =
div
[ class "signIn" ]
- [ button
- ( if signInView.waitingServer
- then [ class "waitingServer" ]
- else [ onClick operations.address Persona.SignIn ]
- )
- [ span [] [ text (getMessage "SignIn" model.translations) ]
- , if signInView.waitingServer
- then renderSpinIcon
- else renderIcon "power-off"
+ [ H.form
+ [ onSubmitPrevDefault address (SignIn signInView.login) ]
+ [ input
+ [ value signInView.login
+ , on "input" targetValue (Signal.message address << UpdateSignIn << UpdateLogin)
+ ]
+ []
+ , button
+ []
+ [ if signInView.waitingServer
+ then renderSpinIcon
+ else text (getMessage "SignIn" model.translations)
+ ]
]
- , signInResult model signInView
+ , div
+ [ class "result" ]
+ [ signInResult model signInView ]
]
signInResult : Model -> SignInView -> Html
signInResult model signInView =
- case signInView.error of
- Just error ->
- div
- [ class "error" ]
- [ text error ]
+ case signInView.result of
+ Just result ->
+ case result of
+ Ok login ->
+ div
+ [ class "success" ]
+ [ text (getMessage "SignInEmailSent" model.translations) ]
+ Err error ->
+ div
+ [ class "error" ]
+ [ text error ]
Nothing ->
text ""