Guest User

Untitled

a guest
Apr 10th, 2018
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. <form action='auth' method='POST' id='loginForm' class='cssform' autocomplete='off'>
  2. <p>
  3. <label for='j_username'>Login ID</label>
  4. <input type='text' class='text_' name='j_username' id='j_username' />
  5. </p>
  6. <p>
  7. <label for='j_password'>Password</label>
  8. <input type='password' class='text_' name='j_password' id='j_password' />
  9. </p>
  10. <p>
  11. <input type='submit' value='Login' />
  12. </p>
  13.  
  14. class LoginController {
  15.  
  16. def index() {
  17. if (session.user?.name == 'test') {
  18. render view: '/login/youarealreadyin'
  19. }
  20. else {
  21. render view: '/login/auth'
  22. }
  23. }
  24.  
  25. def auth() {
  26. def loginName = params.j_username?.trim()
  27. def pass = params.j_password?.trim()
  28.  
  29. if (loginName == 'test' && pass == 'TEST' ) {
  30. session.user = [name: loginName]
  31. redirect uri: '/'
  32. }
  33. else {
  34. render view: '/login/denied'
  35. }
  36. }
  37.  
  38. http://localhost:8080/?j_username=test&j_password=TEST
Add Comment
Please, Sign In to add comment