packages feed

yesod-auth-account 1.4.0 → 1.4.1

raw patch · 4 files changed

+15/−10 lines, 4 filesdep ~persistentPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: persistent

API changes (from Hackage documentation)

- Yesod.Auth.Account: class AccountSendEmail master where sendVerifyEmail uname email url = $logInfo $ concat ["Verification email for ", uname, " (", email, "): ", url] sendNewPasswordEmail uname email url = $logInfo $ concat ["Reset password email for ", uname, " (", email, "): ", url]
+ Yesod.Auth.Account: class AccountSendEmail master where sendVerifyEmail uname email url = ((monadLoggerLog (Loc "Yesod/Auth/Account.hs" "yesod-auth-account-1.4.1" "Yesod.Auth.Account" (744, 11) (744, 18)) (pack "") LevelInfo) . (id :: Text -> Text)) $ concat ["Verification email for ", uname, " (", email, "): ", url] sendNewPasswordEmail uname email url = ((monadLoggerLog (Loc "Yesod/Auth/Account.hs" "yesod-auth-account-1.4.1" "Yesod.Auth.Account" (755, 11) (755, 18)) (pack "") LevelInfo) . (id :: Text -> Text)) $ concat ["Reset password email for ", uname, " (", email, "): ", url]
- Yesod.Auth.Account: class (YesodAuth master, AccountSendEmail master, AccountDB db, UserCredentials (UserAccount db), RenderMessage master FormMessage) => YesodAuthAccount db master | master -> db where checkValidUsername u | all isAlphaNum u = return $ Right u checkValidUsername _ = do { mr <- getMessageRender; return $ Left $ mr MsgInvalidUsername } unregisteredLogin u = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI MsgEmailUnverified; do { (asWidgetT . toWidget) ((preEscapedText . pack) "<p>"); ((liftM (toHtml .) getMessageRender) >>= (\ urender_a7gl -> (asWidgetT . toWidget) (urender_a7gl MsgEmailUnverified))); (asWidgetT . toWidget) ((preEscapedText . pack) "</p>"); (asWidgetT . toWidget) (resendVerifyEmailWidget (username u) tm) } } } getNewAccountR = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI RegisterLong; newAccountWidget tm } } postNewAccountR = do { tm <- getRouteToParent; mr <- lift getMessageRender; ((result, _), _) <- lift $ runFormPost $ renderDivs newAccountForm; mdata <- case result of { FormMissing -> invalidArgs ["Form is missing"] FormFailure msg -> return $ Left msg FormSuccess d -> return $ if newAccountPassword1 d == newAccountPassword2 d then Right d else Left [mr PassMismatch] }; case mdata of { Left errs -> do { setMessage $ toHtml $ concat errs; redirect newAccountR } Right d -> do { void $ lift $ createNewAccount d tm; redirect LoginR } } } allowPasswordReset _ = True getResetPasswordR = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI PasswordResetTitle; resetPasswordWidget tm } } setPasswordHandler u = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI SetPassTitle; newPasswordWidget u tm } } renderAccountMessage _ _ = defaultAccountMsg
+ Yesod.Auth.Account: class (YesodAuth master, AccountSendEmail master, AccountDB db, UserCredentials (UserAccount db), RenderMessage master FormMessage) => YesodAuthAccount db master | master -> db where checkValidUsername u | all isAlphaNum u = return $ Right u checkValidUsername _ = do { mr <- getMessageRender; return $ Left $ mr MsgInvalidUsername } unregisteredLogin u = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI MsgEmailUnverified; (do { (asWidgetT . toWidget) ((preEscapedText . pack) "<p>"); ((liftM (toHtml .) getMessageRender) >>= (\ urender_adgq -> (asWidgetT . toWidget) (urender_adgq MsgEmailUnverified))); (asWidgetT . toWidget) ((preEscapedText . pack) "</p>"); (asWidgetT . toWidget) (resendVerifyEmailWidget (username u) tm) }) } } getNewAccountR = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI RegisterLong; newAccountWidget tm } } postNewAccountR = do { tm <- getRouteToParent; mr <- lift getMessageRender; ((result, _), _) <- lift $ runFormPost $ renderDivs newAccountForm; mdata <- case result of { FormMissing -> invalidArgs ["Form is missing"] FormFailure msg -> return $ Left msg FormSuccess d -> return $ if newAccountPassword1 d == newAccountPassword2 d then Right d else Left [mr PassMismatch] }; case mdata of { Left errs -> do { setMessage $ toHtml $ concat errs; redirect newAccountR } Right d -> do { void $ lift $ createNewAccount d tm; redirect LoginR } } } allowPasswordReset _ = True getResetPasswordR = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI PasswordResetTitle; resetPasswordWidget tm } } setPasswordHandler u = do { tm <- getRouteToParent; lift $ defaultLayout $ do { setTitleI SetPassTitle; newPasswordWidget u tm } } renderAccountMessage _ _ = defaultAccountMsg

Files

Changelog.md view
@@ -1,3 +1,8 @@+# 1.4.1++* Allow newest version of persistent+* Fix some warnings in the test suite+ # 1.4.0  * Add proper support for i18n:
tests/BasicTests.hs view
@@ -45,7 +45,7 @@              post' "/auth/page/account/resetpassword" $ do                 byLabel "Username" "abc"-                addNonce+                addToken              statusIs redirectCode             get' "/"
tests/NewAccount.hs view
@@ -37,7 +37,7 @@             bodyContains "Register"              post'"/auth/page/account/newaccount" $ do-                addNonce+                addToken                 byLabel "Username" "abc"                 byLabel "Email" "test@example.com"                 byLabel "Password" "xxx"@@ -53,7 +53,7 @@             statusIs 200              post'"/auth/page/account/newaccount" $ do-                addNonce+                addToken                 byLabel "Username" "abc"                 byLabel "Email" "test@example.com"                 byLabel "Password" "xxx"@@ -94,7 +94,7 @@              -- resend verify email             post'"/auth/page/account/resendverifyemail" $ do-                addNonce+                addToken                 addPostParam f1 "abc" -- username is also a hidden field             statusIs redirectCode             get' "/"@@ -136,7 +136,7 @@             bodyContains "Send password reset email"             post'"/auth/page/account/resetpassword" $ do                 byLabel "Username" "abc"-                addNonce+                addToken             statusIs redirectCode             get' "/"             statusIs 200@@ -150,7 +150,7 @@             get' newpwd             statusIs 200             post'"/auth/page/account/setpassword" $ do-                addNonce+                addToken                 byLabel "New password" "www"                 byLabel "Confirm" "www"                 addPostParam f1 "abc"@@ -163,7 +163,7 @@             statusIs 200             matches <- htmlQuery $ "input[name=" <> f2 <> "][type=hidden][value]"             post'"/auth/page/account/setpassword" $ do-                addNonce+                addToken                 byLabel "New password" "www"                 byLabel "Confirm" "www"                 addPostParam f1 "abc"@@ -194,7 +194,7 @@             statusIs 200              post' "/auth/page/account/newaccount" $ do-                addNonce+                addToken                 byLabel "Username" "x.y"                 byLabel "Email" "xy@example.com"                 byLabel "Password" "hunter2"
yesod-auth-account.cabal view
@@ -1,5 +1,5 @@ name:              yesod-auth-account-version:           1.4.0+version:           1.4.1 cabal-version:     >= 1.8 build-type:        Simple synopsis:          An account authentication plugin for Yesod@@ -38,7 +38,7 @@                  , mtl               >= 2.1                  , nonce             >= 1.0                  , text              >= 0.11-                 , persistent        >= 1.3        && < 2.2+                 , persistent        >= 1.3        && < 2.3                  , pwstore-fast      >= 2.0                  , yesod-auth        >= 1.2        && < 1.5                  , yesod-core        >= 1.2        && < 1.5