packages feed

yesod-auth 1.6.4 → 1.6.4.1

raw patch · 3 files changed

+19/−13 lines, 3 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

ChangeLog.md view
@@ -1,5 +1,8 @@ # ChangeLog for yesod-auth +## 1.6.4.1+* Email: Fix forgot-password endpoint [#1537](https://github.com/yesodweb/yesod/pull/1537)+ ## 1.6.4  * Make `registerHelper` configurable [#1524](https://github.com/yesodweb/yesod/issues/1524)
Yesod/Auth/Email.hs view
@@ -195,10 +195,12 @@     -- @since 1.1.0     addUnverified :: Email -> VerKey -> AuthHandler site (AuthEmailId site) -    -- | Similar to `addUnverified`, but comes with the registered password-    -- the default implementation is just `addUnverified`, which ignores the password-    -- you may override this to save the salted password to your database+    -- | Similar to `addUnverified`, but comes with the registered password.     --+    -- The default implementation is just `addUnverified`, which ignores the password.+    --+    -- You may override this to save the salted password to your database.+    --     -- @since 1.6.4     addUnverifiedWithPass :: Email -> VerKey -> SaltedPass -> AuthHandler site (AuthEmailId site)     addUnverifiedWithPass email verkey _ = addUnverified email verkey@@ -516,10 +518,10 @@  registerHelper :: YesodAuthEmail master                => Bool -- ^ allow usernames?-               -> Bool -- ^ allow password?+               -> Bool -- ^ forgot password?                -> Route Auth                -> AuthHandler master TypedContent-registerHelper allowUsername allowPassword dest = do+registerHelper allowUsername forgotPassword dest = do     y <- getYesod     checkCsrfHeaderOrParam defaultCsrfHeaderName defaultCsrfParamName     result <- runInputPostResult $ (,)@@ -542,8 +544,8 @@                               | allowUsername -> Right $ TS.strip x                               | otherwise -> Left Msg.InvalidEmailAddress -    let mpass = case (allowPassword, creds) of-                    (True, Just (_, mp)) -> mp+    let mpass = case (forgotPassword, creds) of+                    (False, Just (_, mp)) -> mp                     _ -> Nothing      case eidentifier of@@ -571,9 +573,10 @@                 Nothing -> loginErrorMessageI dest (Msg.IdentifierNotFound identifier)                 Just creds@(_, False, _, _) -> sendConfirmationEmail creds                 Just creds@(_, True, _, _) -> do-                  case emailPreviouslyRegisteredResponse identifier of-                    Just response -> response-                    Nothing -> sendConfirmationEmail creds+                  if forgotPassword then sendConfirmationEmail creds+                    else case emailPreviouslyRegisteredResponse identifier of+                      Just response -> response+                      Nothing -> sendConfirmationEmail creds               where sendConfirmationEmail (lid, _, verKey, email) = do                       render <- getUrlRender                       tp <- getRouteToParent@@ -583,7 +586,7 @@   postRegisterR :: YesodAuthEmail master => AuthHandler master TypedContent-postRegisterR = registerHelper False True registerR+postRegisterR = registerHelper False False registerR  getForgotPasswordR :: YesodAuthEmail master => AuthHandler master Html getForgotPasswordR = forgotPasswordHandler@@ -627,7 +630,7 @@         }  postForgotPasswordR :: YesodAuthEmail master => AuthHandler master TypedContent-postForgotPasswordR = registerHelper True False forgotPasswordR+postForgotPasswordR = registerHelper True True forgotPasswordR  getVerifyR :: YesodAuthEmail site            => AuthEmailId site
yesod-auth.cabal view
@@ -1,5 +1,5 @@ name:            yesod-auth-version:         1.6.4+version:         1.6.4.1 license:         MIT license-file:    LICENSE author:          Michael Snoyman, Patrick Brisbin