on master help sign in
Got log out button working
37b471fiko
frontend/Main.elm+1−1
@@ -339,7 +339,7 @@ loginCallbacks =
339
339
340ciphersCallbacks : Ciphers.Callbacks Msg
340ciphersCallbacks : Ciphers.Callbacks Msg
341ciphersCallbacks =
341ciphersCallbacks =
342− { selected = RequestCipher }
342+ { selected = RequestCipher, logOut = NeedsReset }
343
343
344
344
345cipherCallbacks : Cipher.Callbacks
345cipherCallbacks : Cipher.Callbacks
frontend/Pages/Ciphers.elm+7−1
@@ -66,6 +66,7 @@ menuConfig email { ciphersListFilter, menuVisible } =
66 ]
66 ]
67 , toggle = ToggleMenu
67 , toggle = ToggleMenu
68 , visible = menuVisible
68 , visible = menuVisible
69+ , logOut = LogOut
69 }
70 }
70
71
71
72
@@ -74,10 +75,12 @@ type Msg
74 | UpdateSearch String
75 | UpdateSearch String
75 | ToggleMenu
76 | ToggleMenu
76 | UpdateFilter CiphersFilter
77 | UpdateFilter CiphersFilter
78+ | LogOut
77
79
78
80
79type alias Callbacks msg =
81type alias Callbacks msg =
80 { selected : String -> msg
82 { selected : String -> msg
83+ , logOut : msg
81 }
84 }
82
85
83
86
@@ -121,7 +124,7 @@ init ciphers =
121
124
122
125
123update : Callbacks emsg -> (Msg -> emsg) -> Msg -> Model -> ( Result String Model, Cmd emsg )
126update : Callbacks emsg -> (Msg -> emsg) -> Msg -> Model -> ( Result String Model, Cmd emsg )
124−update {} liftMsg msg model =
127+update { logOut } liftMsg msg model =
125 case msg of
128 case msg of
126 Noop ->
129 Noop ->
127 ( Ok model, Cmd.none )
130 ( Ok model, Cmd.none )
@@ -135,6 +138,9 @@ update {} liftMsg msg model =
135 UpdateFilter filter ->
138 UpdateFilter filter ->
136 ( Ok { model | ciphersListFilter = filter, menuVisible = False }, Cmd.none )
139 ( Ok { model | ciphersListFilter = filter, menuVisible = False }, Cmd.none )
137
140
141+ LogOut ->
142+ ( Ok model, pureCmd logOut )
143+
138
144
139subscriptions : Model -> Sub Msg
145subscriptions : Model -> Sub Msg
140subscriptions model =
146subscriptions model =
frontend/Pages/Login.elm+23−25
@@ -69,31 +69,29 @@ subscriptions model =
69
69
70view : Model -> List (Html Msg)
70view : Model -> List (Html Msg)
71view model =
71view model =
72− [ form []
73− [ label [] [ text "Server" ]
72+ [ label [] [ text "Server" ]
74− , input
73+ , input
75− [ Attr.type_ "url"
74+ [ Attr.type_ "url"
76− , Attr.value model.server
75+ , Attr.value model.server
77− , Ev.onInput UpdateServer
76+ , Ev.onInput UpdateServer
78− , Attr.attribute "autocomplete" "url"
79− ]
80− []
81− , label [] [ text "Email" ]
82− , input
83− [ Attr.type_ "email"
84− , Attr.value model.email
85− , Ev.onInput UpdateEmail
86− , Attr.attribute "autocomplete" "email"
77+ , Attr.attribute "autocomplete" "url"
87− ]
88− []
89− , label [] [ text "Password" ]
90− , input
91− [ Attr.type_ "password"
92− , Attr.value model.password
93− , Ev.onInput UpdatePassword
94− , Attr.attribute "autocomplete" "current-password"
95− ]
96− []
97 ]
78 ]
79+ []
80+ , label [] [ text "Email" ]
81+ , input
82+ [ Attr.type_ "email"
83+ , Attr.value model.email
84+ , Ev.onInput UpdateEmail
85+ , Attr.attribute "autocomplete" "email"
86+ ]
87+ []
88+ , label [] [ text "Password" ]
89+ , input
90+ [ Attr.type_ "password"
91+ , Attr.value model.password
92+ , Ev.onInput UpdatePassword
93+ , Attr.attribute "autocomplete" "current-password"
94+ ]
95+ []
98 , alignRight [ button [ Ev.onClick Submit ] [ text "Log in" ] ]
96 , alignRight [ button [ Ev.onClick Submit ] [ text "Log in" ] ]
99 ]
97 ]
frontend/Pages/MasterPassword.elm+7−9
@@ -77,15 +77,13 @@ view model =
77 ]
77 ]
78 ]
78 ]
79 ]
79 ]
80− , form []
81− [ label [] [ text "Password" ]
80+ , label [] [ text "Password" ]
82− , input
81+ , input
83− [ Attr.type_ "password"
82+ [ Attr.type_ "password"
84− , Attr.value model.password
83+ , Attr.value model.password
85− , Ev.onInput UpdatePassword
84+ , Ev.onInput UpdatePassword
86− , Attr.attribute "autocomplete" "current-password"
85+ , Attr.attribute "autocomplete" "current-password"
87− ]
88− []
89 ]
86 ]
87+ []
90 , alignRight [ button [ Ev.onClick Submit ] [ text "Log in" ] ]
88 , alignRight [ button [ Ev.onClick Submit ] [ text "Log in" ] ]
91 ]
89 ]
frontend/Pages/Navigation.elm+10−2
@@ -67,11 +67,12 @@ type alias MenuConfig msg =
67 , items : List { icon : String, name : String, trigger : msg, current : Bool }
67 , items : List { icon : String, name : String, trigger : msg, current : Bool }
68 , toggle : msg
68 , toggle : msg
69 , visible : Bool
69 , visible : Bool
70+ , logOut : msg
70 }
71 }
71
72
72
73
73mapMenuConfig : (a -> b) -> MenuConfig a -> MenuConfig b
74mapMenuConfig : (a -> b) -> MenuConfig a -> MenuConfig b
74−mapMenuConfig f { title, items, toggle, visible } =
75+mapMenuConfig f { title, items, toggle, visible, logOut } =
75 { items =
76 { items =
76 List.map
77 List.map
77 (\{ icon, name, trigger, current } ->
78 (\{ icon, name, trigger, current } ->
@@ -81,16 +82,23 @@ mapMenuConfig f { title, items, toggle, visible } =
81 , title = title
82 , title = title
82 , toggle = f toggle
83 , toggle = f toggle
83 , visible = visible
84 , visible = visible
85+ , logOut = f logOut
84 }
86 }
85
87
86
88
87menu : MenuConfig msg -> Html msg
89menu : MenuConfig msg -> Html msg
88−menu { title, items, toggle, visible } =
90+menu { title, items, toggle, visible, logOut } =
89 div [ Attr.class "p-side-navigation--icons", Attr.classList [ ( "is-drawer-expanded", visible ) ] ]
91 div [ Attr.class "p-side-navigation--icons", Attr.classList [ ( "is-drawer-expanded", visible ) ] ]
90 [ div [ Attr.class "p-side-navigation__overlay" ] []
92 [ div [ Attr.class "p-side-navigation__overlay" ] []
91 , nav [ Attr.class "p-side-navigation__drawer" ]
93 , nav [ Attr.class "p-side-navigation__drawer" ]
92 [ div [ Attr.class "p-side-navigation__drawer-header" ]
94 [ div [ Attr.class "p-side-navigation__drawer-header" ]
93 [ a [ Attr.class "p-side-navigation__toggle--in-drawer", Ev.onClick toggle ] [ text title ]
95 [ a [ Attr.class "p-side-navigation__toggle--in-drawer", Ev.onClick toggle ] [ text title ]
96+ , button
97+ [ Attr.class "p-button--negative is-inline u-float-right"
98+ , Attr.style "margin-right" "1rem"
99+ , Ev.onClick logOut
100+ ]
101+ [ text "Log out" ]
94 ]
102 ]
95 , ul [ Attr.class "p-side-navigation__list" ]
103 , ul [ Attr.class "p-side-navigation__list" ]
96 (items
104 (items