Fix dummy auth
This commit is contained in:
parent
df1398f756
commit
2eae90d1f8
@ -237,18 +237,18 @@ instance YesodAuth UniWorX where
|
||||
redirectToReferer _ = True
|
||||
|
||||
authenticate Creds{..} = runDB $ do
|
||||
let auth
|
||||
let (plugin, ident)
|
||||
| credsPlugin == "dummy"
|
||||
, [ dummyPlugin, dummyIdent] <- Text.splitOn ":" credsIdent
|
||||
= UniqueAuthentication dummyPlugin dummyIdent
|
||||
, [dummyPlugin, dummyIdent] <- Text.splitOn ":" credsIdent
|
||||
= (dummyPlugin, dummyIdent)
|
||||
| otherwise
|
||||
= UniqueAuthentication credsPlugin credsIdent
|
||||
x <- getBy auth
|
||||
= (credsPlugin, credsIdent)
|
||||
x <- getBy $ UniqueAuthentication plugin ident
|
||||
case x of
|
||||
Just (Entity uid _) -> return $ Authenticated uid
|
||||
Nothing -> Authenticated <$> insert User
|
||||
{ userPlugin = credsPlugin
|
||||
, userIdent = credsIdent
|
||||
{ userPlugin = plugin
|
||||
, userIdent = ident
|
||||
, userMatrikelnummer = "DummyMatrikel"
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user