Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #{form @Application.auth(), id:'loginForm'}
- <p>
- <label>LOGIN:</label>
- <input type="text" id="login" name="login" value="${flash.login}" />
- </p>
- <p>
- <label>PASSWORD:</label>
- <input type="password" id="pass" name="pass" value="" />
- </p>
- <p class="action">
- <input type="submit" value="Go!" onclick="valid()">
- </p>
- #{/form}
- <p>
- <a href="@{registration()}">Зарегестрироваться</a>
- public static void auth(String username, String password) {
- User user = User.findByUsername(username);
- if (username == null || !user.checkPass(password)) {
- flash.error("Bad username or password");
- }
- session.put("username", username);
- if (user != null) {
- flash.success("Welcome %s !", username);
- profileUser();
- }
- }
- File routes:
- # Home page
- GET / controllers.Application.index()
- POST /login controllers.Application.auth()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement