From 9d57e149fcb124a28813c56f83cf254eb92baa42 Mon Sep 17 00:00:00 2001 From: Joris Date: Fri, 11 Mar 2016 23:21:06 +0100 Subject: Don't use persona anymore, use email token to sign in --- src/client/elm/View/SignIn.elm | 54 ++++++++++++++++++++++++++---------------- 1 file changed, 33 insertions(+), 21 deletions(-) (limited to 'src/client/elm/View') 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 "" -- cgit v1.2.3