onasty/web/src/Validators.elm(view raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
module Validators exposing (email, password, passwords)
email : String -> Maybe String
email inp =
if
not (String.isEmpty inp)
&& (not (String.contains "@" inp) && not (String.contains "." inp))
then
Just "Please enter a valid email address."
else
Nothing
password : String -> Maybe String
password passwd =
if not (String.isEmpty passwd) && String.length passwd < 8 then
Just "Password must be at least 8 characters long."
else
Nothing
passwords : String -> String -> Maybe String
passwords passowrd1 password2 =
if not (String.isEmpty passowrd1) && passowrd1 /= password2 then
Just "Passwords do not match."
else
Nothing
|