Change the login form to a Bootstrapped one - still needs some colours tweaked though
This commit is contained in:
parent
f934632484
commit
ea47fb8b50
3 changed files with 33 additions and 2 deletions
|
@ -12,7 +12,7 @@ import Database.Persist.Sql (ConnectionPool, runSqlPool)
|
|||
import Text.Hamlet (hamletFile)
|
||||
import Text.Jasmine (minifym)
|
||||
|
||||
import Yesod.Auth.HashDB (authHashDB)
|
||||
import Yesod.Auth.HashDB (authHashDBWithForm)
|
||||
import qualified Yesod.Auth.Message as AuthMsg
|
||||
|
||||
import Yesod.Default.Util (addStaticContentExternal)
|
||||
|
@ -182,7 +182,11 @@ instance YesodAuth App where
|
|||
toResult = UserError AuthMsg.InvalidLogin `maybe` (Authenticated . entityKey)
|
||||
|
||||
-- You can add other plugins like Google Email, email or OAuth here
|
||||
authPlugins _ = [authHashDB (Just . UniqueUser)]
|
||||
authPlugins _ = [authHashDBWithForm loginForm (Just . UniqueUser)]
|
||||
where loginForm :: Route App -> Widget
|
||||
loginForm action = do
|
||||
mtok <- reqToken <$> getRequest
|
||||
$(widgetFile "auth/login")
|
||||
authHttpManager = getHttpManager
|
||||
|
||||
-- | Access function to determine if a user is logged in.
|
||||
|
|
3
templates/auth/login.cassius
Normal file
3
templates/auth/login.cassius
Normal file
|
@ -0,0 +1,3 @@
|
|||
body > main
|
||||
display: flex
|
||||
align-items: center
|
24
templates/auth/login.hamlet
Normal file
24
templates/auth/login.hamlet
Normal file
|
@ -0,0 +1,24 @@
|
|||
<form .container method="post" action=@{action}>
|
||||
$maybe tok <- mtok
|
||||
<input type="hidden" name=#{defaultCsrfParamName} value=#{tok}>
|
||||
|
||||
<div .card.bg-dark>
|
||||
<div .card-body>
|
||||
<div .form-group>
|
||||
<label .sr-only for="auth-login-username">Username
|
||||
<div .input-group>
|
||||
<span .input-group-addon aria-hidden>
|
||||
<i .fa.fa-user>
|
||||
<input #auth-login-username .form-control type="text" name="username" required>
|
||||
|
||||
<div .form-group>
|
||||
<label .sr-only for="auth-login-password">Password
|
||||
<div .input-group>
|
||||
<span .input-group-addon aria-hidden>
|
||||
<i .fa.fa-key>
|
||||
<input #auth-login-password .form-control type="password" name="password" required>
|
||||
|
||||
<div .card-footer>
|
||||
<button type="submit" class="btn btn-primary">
|
||||
<i .fa.fa-sign-in>
|
||||
Log In
|
Loading…
Reference in a new issue