Safe Haskell | None |
---|---|
Language | Haskell98 |
- data PasswordError
- newtype HashedPass = HashedPass {}
- unHashedPass :: Iso' HashedPass ByteString
- mkHashedPass :: (Functor m, MonadIO m) => Text -> m HashedPass
- verifyHashedPass :: Text -> HashedPass -> Bool
- data PasswordState = PasswordState {}
- passwords :: Iso' PasswordState (Map UserId HashedPass)
- initialPasswordState :: PasswordState
- setPassword :: UserId -> HashedPass -> Update PasswordState ()
- deletePassword :: UserId -> Update PasswordState ()
- verifyPasswordForUserId :: UserId -> Text -> Query PasswordState Bool
- data SetPassword = SetPassword UserId HashedPass
- newtype DeletePassword = DeletePassword UserId
- data VerifyPasswordForUserId = VerifyPasswordForUserId UserId Text
- verifyPassword :: MonadIO m => AcidState AuthenticateState -> AcidState PasswordState -> Username -> Text -> m Bool
- data UserPass = UserPass {}
- user :: Lens' UserPass Username
- password :: Lens' UserPass Text
- token :: Happstack m => AcidState AuthenticateState -> (UserId -> IO Bool) -> AcidState PasswordState -> m Response
- data NewAccountData = NewAccountData {
- _naUser :: User
- _naPassword :: Text
- _naPasswordConfirm :: Text
- naUser :: Lens' NewAccountData User
- naPasswordConfirm :: Lens' NewAccountData Text
- naPassword :: Lens' NewAccountData Text
- data ChangePasswordData = ChangePasswordData {}
- cpOldPassword :: Lens' ChangePasswordData Text
- cpNewPasswordConfirm :: Lens' ChangePasswordData Text
- cpNewPassword :: Lens' ChangePasswordData Text
- account :: Happstack m => AcidState AuthenticateState -> AcidState PasswordState -> Maybe (UserId, AccountURL) -> m (Either PasswordError UserId)
- data RequestResetPasswordData = RequestResetPasswordData {}
- rrpUsername :: Iso' RequestResetPasswordData Username
- passwordRequestReset :: Happstack m => Text -> Text -> AcidState AuthenticateState -> AcidState PasswordState -> m (Either PasswordError Text)
- issueResetToken :: MonadIO m => AcidState AuthenticateState -> User -> m (Either PasswordError JSON)
- sendResetEmail :: MonadIO m => Email -> Email -> Text -> m ()
- data ResetPasswordData = ResetPasswordData {}
- rpResetToken :: Lens' ResetPasswordData Text
- rpPasswordConfirm :: Lens' ResetPasswordData Text
- rpPassword :: Lens' ResetPasswordData Text
- passwordReset :: Happstack m => AcidState AuthenticateState -> AcidState PasswordState -> m (Either PasswordError ())
- decodeAndVerifyResetToken :: MonadIO m => AcidState AuthenticateState -> Text -> m (Maybe (User, JWT VerifiedJWT))
Documentation
data PasswordError Source
NotAuthenticated | |
NotAuthorized | |
InvalidUsername | |
InvalidPassword | |
InvalidUsernamePassword | |
NoEmailAddress | |
MissingResetToken | |
InvalidResetToken | |
PasswordMismatch | |
CoreError | |
newtype HashedPass Source
:: (Functor m, MonadIO m) | |
=> Text | password in plain text |
-> m HashedPass | salted and hashed |
hash a password string
:: Text | password in plain text |
-> HashedPass | hashed version of password |
-> Bool |
verify a password
data PasswordState Source
:: UserId | UserId |
-> HashedPass | the hashed password |
-> Update PasswordState () |
set the password for UserId
verifyPasswordForUserId Source
:: UserId | UserId |
-> Text | plain-text password |
-> Query PasswordState Bool |
verify that the supplied password matches the stored hashed password for UserId
data SetPassword Source
newtype DeletePassword Source
verifyPassword :: MonadIO m => AcidState AuthenticateState -> AcidState PasswordState -> Username -> Text -> m Bool Source
verify that the supplied username/password is valid
token :: Happstack m => AcidState AuthenticateState -> (UserId -> IO Bool) -> AcidState PasswordState -> m Response Source
data NewAccountData Source
JSON record for new account data
data ChangePasswordData Source
JSON record for change password data
account :: Happstack m => AcidState AuthenticateState -> AcidState PasswordState -> Maybe (UserId, AccountURL) -> m (Either PasswordError UserId) Source
account handler
data RequestResetPasswordData Source
JSON record for new account data
passwordRequestReset :: Happstack m => Text -> Text -> AcidState AuthenticateState -> AcidState PasswordState -> m (Either PasswordError Text) Source
request reset password
issueResetToken :: MonadIO m => AcidState AuthenticateState -> User -> m (Either PasswordError JSON) Source
issueResetToken
data ResetPasswordData Source
JSON record for new account data
passwordReset :: Happstack m => AcidState AuthenticateState -> AcidState PasswordState -> m (Either PasswordError ()) Source
decodeAndVerifyResetToken :: MonadIO m => AcidState AuthenticateState -> Text -> m (Maybe (User, JWT VerifiedJWT)) Source