diff --git a/Application.hs b/Application.hs index 9491d75..cc55a67 100644 --- a/Application.hs +++ b/Application.hs @@ -14,7 +14,7 @@ module Application import Control.Monad.Logger (liftLoc, runLoggingT) import Database.Persist.Postgresql (createPostgresqlPool, pgConnStr, - pgPoolSize, runSqlPool) + pgPoolSize, runSqlPool, runMigrationUnsafe) import Import import Language.Haskell.TH.Syntax (qLocation) import Network.Wai.Handler.Warp (Settings, defaultSettings, @@ -32,6 +32,8 @@ import System.Log.FastLogger (defaultBufSize, newStdoutLoggerSet, -- Don't forget to add new modules to your cabal file! import Handler.Common import Handler.Home +import Handler.Wallet +import Handler.Register -- This line actually creates our YesodDispatch instance. It is the second half -- of the call to mkYesodData which occurs in Foundation.hs. Please see the @@ -67,7 +69,7 @@ makeFoundation appSettings = do (pgPoolSize $ appDatabaseConf appSettings) -- Perform database migration using our application's logging settings. - runLoggingT (runSqlPool (runMigration migrateAll) pool) logFunc + runLoggingT (runSqlPool (runMigrationUnsafe migrateAll) pool) logFunc -- Return the foundation return $ mkFoundation pool diff --git a/Foundation.hs b/Foundation.hs index 81bb68e..fd7b35f 100644 --- a/Foundation.hs +++ b/Foundation.hs @@ -121,7 +121,9 @@ instance YesodAuth App where -- Override the above two destinations when a Referer: header is present redirectToReferer _ = True - getAuthId creds = runDB $ do + getAuthId creds = do + now <- liftIO getCurrentTime + runDB $ do x <- getBy $ UniqueUser $ credsIdent creds case x of Just (Entity uid _) -> return $ Just uid @@ -129,6 +131,7 @@ instance YesodAuth App where fmap Just $ insert User { userIdent = credsIdent creds , userPassword = Nothing + , userLastLogin = now } -- You can add other plugins like BrowserID, email or OAuth here diff --git a/Handler/Home.hs b/Handler/Home.hs index 86e3039..200b442 100644 --- a/Handler/Home.hs +++ b/Handler/Home.hs @@ -2,7 +2,8 @@ module Handler.Home where import Import import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3, - withSmallInput) + withSmallInput, withPlaceholder, bfs, + withAutofocus) -- This is a handler function for the GET request method on the HomeR -- resource pattern. All of your resource patterns are defined in @@ -13,13 +14,27 @@ import Yesod.Form.Bootstrap3 (BootstrapFormLayout (..), renderBootstrap3, -- inclined, or create a single monolithic file. getHomeR :: Handler Html getHomeR = do + (loginWidget, loginEnctype) <- generateFormPost loginForm + defaultLayout $ do + setTitle "NEAT" + [whamlet| +

+ Welcome to NEAT. +
+ Login +
+ ^{loginWidget} +