Fix dummy auth

This commit is contained in:
Gregor Kleen 2017-10-09 13:52:54 +02:00
parent df1398f756
commit 2eae90d1f8

View File

@ -237,18 +237,18 @@ instance YesodAuth UniWorX where
redirectToReferer _ = True redirectToReferer _ = True
authenticate Creds{..} = runDB $ do authenticate Creds{..} = runDB $ do
let auth let (plugin, ident)
| credsPlugin == "dummy" | credsPlugin == "dummy"
, [ dummyPlugin, dummyIdent] <- Text.splitOn ":" credsIdent , [dummyPlugin, dummyIdent] <- Text.splitOn ":" credsIdent
= UniqueAuthentication dummyPlugin dummyIdent = (dummyPlugin, dummyIdent)
| otherwise | otherwise
= UniqueAuthentication credsPlugin credsIdent = (credsPlugin, credsIdent)
x <- getBy auth x <- getBy $ UniqueAuthentication plugin ident
case x of case x of
Just (Entity uid _) -> return $ Authenticated uid Just (Entity uid _) -> return $ Authenticated uid
Nothing -> Authenticated <$> insert User Nothing -> Authenticated <$> insert User
{ userPlugin = credsPlugin { userPlugin = plugin
, userIdent = credsIdent , userIdent = ident
, userMatrikelnummer = "DummyMatrikel" , userMatrikelnummer = "DummyMatrikel"
} }