yesod-auth-bcryptdb 0.1.0.0 → 0.1.0.1
raw patch · 2 files changed
+9/−6 lines, 2 filesPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
API changes (from Hackage documentation)
- Yesod.Auth.BCryptDB: setPassword :: BCryptDBUser user => Password -> HashingPolicy -> user -> IO user
+ Yesod.Auth.BCryptDB: setPassword :: BCryptDBUser user => Text -> HashingPolicy -> user -> IO user
- Yesod.Auth.BCryptDB: validateCreds :: BCryptDBPersist master user => Unique user -> Password -> HandlerT master IO Bool
+ Yesod.Auth.BCryptDB: validateCreds :: BCryptDBPersist master user => Unique user -> Text -> HandlerT master IO Bool
Files
src/Yesod/Auth/BCryptDB.hs view
@@ -168,8 +168,6 @@ defaultCsrfParamName = "_token" #endif -type Password = Text- -- | The type representing user information stored in the database should -- be an instance of this class. It just provides the getter and setter -- used by the functions in this module.@@ -190,14 +188,19 @@ {-# MINIMAL setPasswordSaltedHash, userPasswordSaltedHash #-} -- | Calculate salted hash using Bcrypt.-saltAndHashPassword :: Password -> HashingPolicy -> IO (Maybe Text)+saltAndHashPassword :: Text -> HashingPolicy -> IO (Maybe Text) saltAndHashPassword password hashingPolicy = do hash <- hashPasswordUsingPolicy hashingPolicy . BS.pack $ unpack password return $ pack . BS.unpack <$> hash -- | Set password for user. This function should be used for setting -- passwords. It generates random salt and calculates proper hashes.-setPassword :: BCryptDBUser user => Password -> HashingPolicy -> user -> IO user+setPassword+ :: BCryptDBUser user+ => Text -- ^ Password+ -> HashingPolicy -- ^ @slowerBcryptHashingPolicy@ is recommended+ -> user+ -> IO user setPassword password hashingPolicy user = do mHash <- saltAndHashPassword password hashingPolicy return $ case mHash of@@ -213,7 +216,7 @@ validateCreds :: BCryptDBPersist master user => Unique user -- ^ User unique identifier- -> Password+ -> Text -- ^ Password given -> HandlerT master IO Bool validateCreds userID password = do -- Checks that hash and password match
yesod-auth-bcryptdb.cabal view
@@ -1,5 +1,5 @@ name: yesod-auth-bcryptdb-version: 0.1.0.0+version: 0.1.0.1 synopsis: Authentication plugin for Yesod. description: This package provides authentication with passwords hashed and salted using