diff --git a/config/models b/config/models index bb3da5a..1b8f775 100644 --- a/config/models +++ b/config/models @@ -1,22 +1,17 @@ User - ident Text sqltype=varchar(255) - fullName Text sqltype=varchar(500) - email Text sqltype=varchar(255) + username Text maxlen=190 + fullName Text maxlen=500 + email Text maxlen=190 note Text - password Text Maybe sqltype=varchar(255) default=NULL - UniqueUser ident + UniqueUsername username + UniqueEmail email 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 icon Text sqltype=varchar(255) url Text sqltype=varchar(255) + Profile userId UserId siteId SiteId username Text sqltype=varchar(255) - - -- By default this file is used in Model.hs (which is imported by Foundation.hs) diff --git a/src/Foundation.hs b/src/Foundation.hs index 1c6860c..71b21a4 100644 --- a/src/Foundation.hs +++ b/src/Foundation.hs @@ -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 diff --git a/src/Handler/Home.hs b/src/Handler/Home.hs index a36b181..bdbe454 100644 --- a/src/Handler/Home.hs +++ b/src/Handler/Home.hs @@ -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") diff --git a/templates/profile.hamlet b/templates/profile.hamlet deleted file mode 100644 index 2420de6..0000000 --- a/templates/profile.hamlet +++ /dev/null @@ -1,10 +0,0 @@ -
- -

- Access granted! - -

- This page is protected and access is allowed only for authenticated users. - -

- Your data is protected with us #{userIdent user}!