Clean up user entity - remove unused fields, adjust order
This commit is contained in:
parent
4023b17e85
commit
a070ceef3c
4 changed files with 10 additions and 26 deletions
|
@ -1,22 +1,17 @@
|
||||||
User
|
User
|
||||||
ident Text sqltype=varchar(255)
|
username Text maxlen=190
|
||||||
fullName Text sqltype=varchar(500)
|
fullName Text maxlen=500
|
||||||
email Text sqltype=varchar(255)
|
email Text maxlen=190
|
||||||
note Text
|
note Text
|
||||||
password Text Maybe sqltype=varchar(255) default=NULL
|
UniqueUsername username
|
||||||
UniqueUser ident
|
UniqueEmail email
|
||||||
deriving Typeable
|
deriving Typeable
|
||||||
Comment json -- Adding "json" causes ToJSON and FromJSON instances to be derived.
|
|
||||||
message Text sqltype=varchar(255)
|
|
||||||
userId UserId Maybe default=NULL
|
|
||||||
deriving Eq
|
|
||||||
deriving Show
|
|
||||||
Site
|
Site
|
||||||
icon Text sqltype=varchar(255)
|
icon Text sqltype=varchar(255)
|
||||||
url Text sqltype=varchar(255)
|
url Text sqltype=varchar(255)
|
||||||
|
|
||||||
Profile
|
Profile
|
||||||
userId UserId
|
userId UserId
|
||||||
siteId SiteId
|
siteId SiteId
|
||||||
username Text sqltype=varchar(255)
|
username Text sqltype=varchar(255)
|
||||||
|
|
||||||
-- By default this file is used in Model.hs (which is imported by Foundation.hs)
|
|
||||||
|
|
|
@ -188,15 +188,14 @@ instance YesodAuth App where
|
||||||
redirectToReferer _ = True
|
redirectToReferer _ = True
|
||||||
|
|
||||||
authenticate creds = runDB $ do
|
authenticate creds = runDB $ do
|
||||||
x <- getBy $ UniqueUser $ credsIdent creds
|
x <- getBy . UniqueUsername $ credsIdent creds
|
||||||
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
|
||||||
{ userIdent = credsIdent creds
|
{ userUsername = credsIdent creds
|
||||||
, userFullName = ""
|
, userFullName = ""
|
||||||
, userEmail = ""
|
, userEmail = ""
|
||||||
, userNote = ""
|
, userNote = ""
|
||||||
, userPassword = Nothing
|
|
||||||
}
|
}
|
||||||
|
|
||||||
-- You can add other plugins like Google Email, email or OAuth here
|
-- You can add other plugins like Google Email, email or OAuth here
|
||||||
|
|
|
@ -10,5 +10,5 @@ import Widget.Hcard (hcard)
|
||||||
|
|
||||||
getHomeR :: Handler Html
|
getHomeR :: Handler Html
|
||||||
getHomeR = do
|
getHomeR = do
|
||||||
user <- runDB . getBy404 $ UniqueUser "dani"
|
user <- runDB . getBy404 $ UniqueUsername "dani"
|
||||||
defaultLayout $(widgetFile "home")
|
defaultLayout $(widgetFile "home")
|
||||||
|
|
|
@ -1,10 +0,0 @@
|
||||||
<div .ui.container>
|
|
||||||
|
|
||||||
<h1>
|
|
||||||
Access granted!
|
|
||||||
|
|
||||||
<p>
|
|
||||||
This page is protected and access is allowed only for authenticated users.
|
|
||||||
|
|
||||||
<p>
|
|
||||||
Your data is protected with us <strong><span class="username">#{userIdent user}</span></strong>!
|
|
Loading…
Reference in a new issue