Clean up user entity - remove unused fields, adjust order

This commit is contained in:
Danielle McLean 2017-10-03 14:52:23 +11:00
parent 4023b17e85
commit a070ceef3c
Signed by: 00dani
GPG key ID: 3844A6973C6058F1
4 changed files with 10 additions and 26 deletions

View file

@ -188,15 +188,14 @@ instance YesodAuth App where
redirectToReferer _ = True
authenticate creds = runDB $ do
x <- getBy $ UniqueUser $ credsIdent creds
x <- getBy . UniqueUsername $ credsIdent creds
case x of
Just (Entity uid _) -> return $ Authenticated uid
Nothing -> Authenticated <$> insert User
{ userIdent = credsIdent creds
{ userUsername = credsIdent creds
, userFullName = ""
, userEmail = ""
, userNote = ""
, userPassword = Nothing
}
-- You can add other plugins like Google Email, email or OAuth here

View file

@ -10,5 +10,5 @@ import Widget.Hcard (hcard)
getHomeR :: Handler Html
getHomeR = do
user <- runDB . getBy404 $ UniqueUser "dani"
user <- runDB . getBy404 $ UniqueUsername "dani"
defaultLayout $(widgetFile "home")