aboutsummaryrefslogtreecommitdiff
path: root/common/src/Common/Validation
diff options
context:
space:
mode:
Diffstat (limited to 'common/src/Common/Validation')
-rw-r--r--common/src/Common/Validation/Atomic.hs12
-rw-r--r--common/src/Common/Validation/SignIn.hs14
2 files changed, 14 insertions, 12 deletions
diff --git a/common/src/Common/Validation/Atomic.hs b/common/src/Common/Validation/Atomic.hs
index 4bb7cad..9c21e14 100644
--- a/common/src/Common/Validation/Atomic.hs
+++ b/common/src/Common/Validation/Atomic.hs
@@ -1,10 +1,11 @@
module Common.Validation.Atomic
- ( nonEmpty
+ ( color
+ , day
, minLength
- , number
+ , nonEmpty
, nonNullNumber
- , day
- , color
+ , number
+ , password
) where
import qualified Data.Char as Char
@@ -55,3 +56,6 @@ color str =
else
V.Failure (Msg.get Msg.Form_InvalidColor)
+
+password :: Text -> Validation Text Text
+password = minLength 8
diff --git a/common/src/Common/Validation/SignIn.hs b/common/src/Common/Validation/SignIn.hs
index 18ceb44..ac9cc37 100644
--- a/common/src/Common/Validation/SignIn.hs
+++ b/common/src/Common/Validation/SignIn.hs
@@ -1,19 +1,17 @@
module Common.Validation.SignIn
- ( signIn
- , email
+ ( email
+ , password
) where
import Data.Text (Text)
import Data.Validation (Validation)
import Common.Model.Email (Email (..))
-import Common.Model.SignInForm (SignInForm (..))
+import Common.Model.Password (Password (..))
import qualified Common.Validation.Atomic as Atomic
-import qualified Data.Validation as Validation
-
-signIn :: SignInForm -> Maybe Email
-signIn (SignInForm str) =
- Validation.validation (const Nothing) Just . email $ str
email :: Text -> Validation Text Email
email = fmap Email . Atomic.minLength 5
+
+password :: Text -> Validation Text Password
+password = fmap Password . Atomic.minLength 8