Moved login logic into a function

This is more clear and looks like the other authorization plugins.
This commit is contained in:
Alex Kardos 2016-02-20 21:26:58 -07:00
parent 456e93fb10
commit 1cae0e38ab

View File

@ -258,10 +258,11 @@ class ( YesodAuth site
authEmail :: YesodAuthEmail m => AuthPlugin m authEmail :: YesodAuthEmail m => AuthPlugin m
authEmail = authEmail =
AuthPlugin "email" dispatch $ \tm -> AuthPlugin "email" dispatch login
where
login tm =
[whamlet| [whamlet|
$newline never <form method="post" action="@{tm loginR}">
<form method="post" action="@{tm loginR}">
<table> <table>
<tr> <tr>
<th>_{Msg.Email} <th>_{Msg.Email}
@ -278,8 +279,7 @@ $newline never
&nbsp; &nbsp;
<a href="@{tm registerR}" .btn .btn-default> <a href="@{tm registerR}" .btn .btn-default>
_{Msg.RegisterLong} _{Msg.RegisterLong}
|] |]
where
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