Advertisement
Guest User

Untitled

a guest
Oct 10th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.83 KB | None | 0 0
  1. <body>
  2. <div class="container">
  3. <div class="row">
  4. <div class="wrap-login col-md-4 col-md-offset-4">
  5. <h2 style="margin-bottom: 20px;">ATP Login</h2>
  6. <form action="Login" method="post">
  7. <label>Username</label>
  8. <div class="input-group">
  9. <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
  10. <input id="username" type="text" class="form-control" name="username" placeholder="Username">
  11. </div>
  12. <label style="margin-top: 15px;">Password</label>
  13. <div class="input-group">
  14. <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
  15. <input id="password" type="password" class="form-control" name="password" placeholder="Password">
  16. </div>
  17. <%
  18. if(session.getAttribute("loginSuccessful") != null && session.getAttribute("loginSuccessful") == "false") {
  19. %>
  20. <div class="alert alert-danger" style="margin-top: 10px;">
  21. <strong>Wrong username and password combination.</strong> Please, check your login information and try again.
  22. </div>
  23. <%
  24. }
  25. %>
  26. <button type="submit" class="btn btn-default login-btn" >Login</button>
  27. </form>
  28. </div>
  29. </div>
  30. </div>
  31. </body>
  32.  
  33. @Override
  34. protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
  35.  
  36. String username = request.getParameter("username");
  37. String password = request.getParameter("password");
  38.  
  39. HttpSession session = request.getSession();
  40. //Check login
  41. Boolean successful = CheckLogin(username,password);
  42. if (successful) {
  43. response.sendRedirect("Environments.jsp");
  44. }
  45. else {
  46. session.setAttribute("loginSuccessful","false");
  47. response.sendRedirect("index.jsp");
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement