From 216f2b81064ad43e266ec04bc0ce75d24fc3798d Mon Sep 17 00:00:00 2001 From: Michael Snoyman Date: Mon, 15 Dec 2014 15:17:10 +0200 Subject: [PATCH] Fix double login problem (closes #56) --- Foundation.hs | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/Foundation.hs b/Foundation.hs index 7a8b9c0..d980450 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -212,11 +212,19 @@ instance YesodAuth App where , " added to your account." ] redirect ProfileR - Just _ -> invalidArgs $ return $ concat - [ "The email address " - , credsIdent creds - , " is already associated with a different account." - ] + Just (Entity _ email) + | emailUser email == uid -> return $ do + setMessage $ toHtml $ concat + [ "The email address " + , credsIdent creds + , " is already part of your account" + ] + redirect ProfileR + | otherwise -> invalidArgs $ return $ concat + [ "The email address " + , credsIdent creds + , " is already associated with a different account." + ] where handleBase = takeWhile (/= '@') (credsIdent creds) getHandle cnt | cnt > 50 = error "Could not get a unique slug"