about summary refs log tree commit diff
path: root/src/Types.hs
diff options
context:
space:
mode:
authorWilliam Carroll <wpcarro@gmail.com>2020-07-28T10·19+0100
committerWilliam Carroll <wpcarro@gmail.com>2020-07-28T10·19+0100
commit502126243d221fc56345ccd7e4b72882f2128953 (patch)
tree6d3cdef1c837a41b9cb60d56a14380a73415d539 /src/Types.hs
parent2398f1bd40235ce4ff031dccbde4d04b32395292 (diff)
Prefer name ClearTextPassword to Password
I expect my application to have two types for passwords:
- ClearTextPassword
- CipherTextPassword
Diffstat (limited to 'src/Types.hs')
-rw-r--r--src/Types.hs20
1 files changed, 10 insertions, 10 deletions
diff --git a/src/Types.hs b/src/Types.hs
index 2f78ddb9a112..bd4544deb09a 100644
--- a/src/Types.hs
+++ b/src/Types.hs
@@ -43,17 +43,17 @@ instance ToField Username where
 instance FromField Username where
   fromField = forNewtype Username
 
-newtype Password = Password Text
+newtype ClearTextPassword = ClearTextPassword Text
   deriving (Eq, Show, Generic)
 
-instance ToJSON Password
-instance FromJSON Password
+instance ToJSON ClearTextPassword
+instance FromJSON ClearTextPassword
 
-instance ToField Password where
-  toField (Password x) = SQLText x
+instance ToField ClearTextPassword where
+  toField (ClearTextPassword x) = SQLText x
 
-instance FromField Password where
-  fromField = forNewtype Password
+instance FromField ClearTextPassword where
+  fromField = forNewtype ClearTextPassword
 
 newtype Email = Email Text
   deriving (Eq, Show, Generic)
@@ -101,7 +101,7 @@ instance FromField ProfilePicture where
 
 data Account = Account
   { accountUsername :: Username
-  , accountPassword :: Password
+  , accountPassword :: ClearTextPassword
   , accountEmail :: Email
   , accountRole :: Role
   , accountProfilePicture :: ProfilePicture
@@ -112,7 +112,7 @@ instance ToJSON Account
 instance FromJSON Account
 
 -- | Return a tuple with all of the fields for an Account record to use for SQL.
-accountFields :: Account -> (Username, Password, Email, Role, ProfilePicture)
+accountFields :: Account -> (Username, ClearTextPassword, Email, Role, ProfilePicture)
 accountFields (Account { accountUsername
                        , accountPassword
                        , accountEmail
@@ -135,7 +135,7 @@ instance FromRow Account where
 
 data Session = Session
   { username :: Username
-  , password :: Password
+  , password :: ClearTextPassword
   , role :: Role
   } deriving (Eq, Show)