diff options
author | Yorhel <git@yorhel.nl> | 2019-09-30 18:05:28 +0200 |
---|---|---|
committer | Yorhel <git@yorhel.nl> | 2019-09-30 18:05:41 +0200 |
commit | 2d7e855cfb37f35cb2cd0f8f39754002c20c8a7c (patch) | |
tree | b1ff536adee289c3b6e1a56c1f1a71acd1da6c87 /elm/Lib | |
parent | 24e08e0f2caf8dede4a0c8a77b8ede1e13899785 (diff) |
v2rw: Convert login, logout & insecure-password-change forms
The insecure-password-change flow is now slightly more friendly. The
logout functionality has been hardened to use POST and require CSRF.
Diffstat (limited to 'elm/Lib')
-rw-r--r-- | elm/Lib/Api.elm | 3 | ||||
-rw-r--r-- | elm/Lib/Html.elm | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/elm/Lib/Api.elm b/elm/Lib/Api.elm index 31bf3613..d1d0bc10 100644 --- a/elm/Lib/Api.elm +++ b/elm/Lib/Api.elm @@ -32,6 +32,9 @@ showResponse res = Unchanged -> "No changes" Changed _ _ -> unexp Content _ -> unexp + BadLogin -> "Invalid username or password." + LoginThrottle -> "Action throttled, too many failed login attempts." + InsecurePass -> "Your chosen password is in a database of leaked passwords, please choose another one." expectResponse : (Response -> msg) -> Http.Expect msg diff --git a/elm/Lib/Html.elm b/elm/Lib/Html.elm index bbd2e1fb..41f6e376 100644 --- a/elm/Lib/Html.elm +++ b/elm/Lib/Html.elm @@ -53,6 +53,19 @@ inputText nam val onch attrs = input ( ) [] +inputPassword : String -> String -> (String -> m) -> List (Attribute m) -> Html m +inputPassword nam val onch attrs = input ( + [ type_ "password" + , class "text" + , tabindex 10 + , value val + , onInput onch + ] + ++ attrs + ++ (if nam == "" then [] else [ id nam, name nam ]) + ) [] + + inputTextArea : String -> String -> (String -> m) -> List (Attribute m) -> Html m inputTextArea nam val onch attrs = textarea ( [ tabindex 10 |