Moved login logic into a function
This is more clear and looks like the other authorization plugins.
This commit is contained in:
parent
456e93fb10
commit
1cae0e38ab
@ -258,28 +258,28 @@ class ( YesodAuth site
|
|||||||
|
|
||||||
authEmail :: YesodAuthEmail m => AuthPlugin m
|
authEmail :: YesodAuthEmail m => AuthPlugin m
|
||||||
authEmail =
|
authEmail =
|
||||||
AuthPlugin "email" dispatch $ \tm ->
|
AuthPlugin "email" dispatch login
|
||||||
[whamlet|
|
|
||||||
$newline never
|
|
||||||
<form method="post" action="@{tm loginR}">
|
|
||||||
<table>
|
|
||||||
<tr>
|
|
||||||
<th>_{Msg.Email}
|
|
||||||
<td>
|
|
||||||
<input type="email" name="email" required>
|
|
||||||
<tr>
|
|
||||||
<th>_{Msg.Password}
|
|
||||||
<td>
|
|
||||||
<input type="password" name="password" required>
|
|
||||||
<tr>
|
|
||||||
<td colspan="2">
|
|
||||||
<button type=submit .btn .btn-success>
|
|
||||||
_{Msg.LoginViaEmail}
|
|
||||||
|
|
||||||
<a href="@{tm registerR}" .btn .btn-default>
|
|
||||||
_{Msg.RegisterLong}
|
|
||||||
|]
|
|
||||||
where
|
where
|
||||||
|
login tm =
|
||||||
|
[whamlet|
|
||||||
|
<form method="post" action="@{tm loginR}">
|
||||||
|
<table>
|
||||||
|
<tr>
|
||||||
|
<th>_{Msg.Email}
|
||||||
|
<td>
|
||||||
|
<input type="email" name="email" required>
|
||||||
|
<tr>
|
||||||
|
<th>_{Msg.Password}
|
||||||
|
<td>
|
||||||
|
<input type="password" name="password" required>
|
||||||
|
<tr>
|
||||||
|
<td colspan="2">
|
||||||
|
<button type=submit .btn .btn-success>
|
||||||
|
_{Msg.LoginViaEmail}
|
||||||
|
|
||||||
|
<a href="@{tm registerR}" .btn .btn-default>
|
||||||
|
_{Msg.RegisterLong}
|
||||||
|
|]
|
||||||
dispatch "GET" ["register"] = getRegisterR >>= sendResponse
|
dispatch "GET" ["register"] = getRegisterR >>= sendResponse
|
||||||
dispatch "POST" ["register"] = postRegisterR >>= sendResponse
|
dispatch "POST" ["register"] = postRegisterR >>= sendResponse
|
||||||
dispatch "GET" ["forgot-password"] = getForgotPasswordR >>= sendResponse
|
dispatch "GET" ["forgot-password"] = getForgotPasswordR >>= sendResponse
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user