You could look at your validation checks. Do you need to check against model.passwordAgain
as well as model.password
?
Personally, I wouldn’t do the validation check on model.passwordAgain
- only on model.password
. The reason being:
- Your messages to the user only state ‘Password must …’
- You have
pwIsMatched
in place, so whenmodel.password
passes all the validation, you know thatmodel.passwordAgain
does too if this function returnsTrue
.
If you must check both, comparing both with an ||
means the user will get a check mark if just model.passwordAgain
passes, which doesn’t make sense to me. It may better to use &&
to check both pass the validation.
You have a typo in pwIsUpper
, you are checking model.password
twice.
You could write viewSubmitButton
like so (just a suggestion):
viewSubmitButton : Model -> Html msg
viewSubmitButton model =
let
disabled_ =
not (pwLength model && pwIsUpper model && pwIsLower model && pwIsDigit model && pwIsMatched model)
in
button [ disabled disabled_ ] [ text "Submit" ]
Otherwise all looks good to me.