Commits

Luke Plant  committed 7bb9587

Removed use of 'widgets' for login page, which provide no value.

  • Participants
  • Parent commits 80c6a8c

Comments (0)

Files changed (4)

File src/Blog/Forms.hs

                          , identifier = "id_message"
                          }
 
-passwordWidget = TextInput { value = ""
-                           , size = Just 20
-                           , maxlength = Just 20
-                           , name = "password"
-                           , identifier = "id_password"
-                           , password = True
-                           }
-
-usernameWidget = nameWidget { TI.name = "username"
-                            , TI.identifier = "id_username"
-                            }
-
 -- | Enum for the different stages of submitting a comment
 data CommentStage = NoComment
                   | CommentPreview

File src/Blog/Templates.hs

 module Blog.Templates
 where
 
-import Blog.Forms (emailWidget, nameWidget, messageWidget, formatWidget, usernameWidget, passwordWidget, CommentStage(..))
+import Blog.Forms (emailWidget, nameWidget, messageWidget, formatWidget, CommentStage(..))
 import Blog.Links
 import Blog.Utils (escapeHtmlStringT)
 import Data.Maybe (fromJust)
 commentSubmitButton    = submit "submit" "Post"
 commentPreviewButton   = submit "preview" "Preview"
 
-loginUsernameLabel = makeLabel "User name:" usernameWidget
-loginUsernameWidget :: Map.Map String String -> TextInput
-loginUsernameWidget loginData = setVal (fromJust $ Map.lookup "username" loginData) usernameWidget
-loginPasswordLabel = makeLabel "Password: " passwordWidget
-loginPasswordWidget :: Map.Map String String -> TextInput
-loginPasswordWidget loginData = setVal (fromJust $ Map.lookup "password" loginData) passwordWidget
-
 -- General HTML fragments
 
 -- TODO - fix this to be able to work with URLs that have query

File src/Blog/Views.hs

              ("loginInvalid", not $ Map.null loginErrors)
              ("loginErrors", Map.toList loginErrors)
              ("loginData", loginData)
-             ("usernameLabel", X.toHtml $ loginUsernameLabel)
-             ("usernameWidget", X.toHtml $ loginUsernameWidget loginData)
-             ("passwordLabel", X.toHtml $ loginPasswordLabel)
-             ("passwordWidget", X.toHtml $ loginPasswordWidget loginData)
             )
 
         loginTemplate = get_template "login"

File src/templates/login.st

   $csrffield:noescape()$
   <table>
     <tr>
-      <td>$usernameLabel:noescape()$</td>
-      <td>$usernameWidget:noescape()$</td>
+      <td><label for="id_username">User name:</label></td>
+      <td><input type="text" name="username" value="$loginData.username$" id="id_username" maxlength="100" size="20" /></td>
     </tr>
     <tr>
-      <td>$passwordLabel:noescape()$</td>
-      <td>$passwordWidget:noescape()$</td>
+      <td><label for="id_password">Password: </label></td>
+      <td><input type="password" name="password" value="$loginData.password$" id="id_password" maxlength="20" size="20" /></td>
     </tr>
   </table>
   <div>