Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <body>
- <div class="container">
- <div class="row">
- <div class="wrap-login col-md-4 col-md-offset-4">
- <h2 style="margin-bottom: 20px;">ATP Login</h2>
- <form action="Login" method="post">
- <label>Username</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="glyphicon glyphicon-user"></i></span>
- <input id="username" type="text" class="form-control" name="username" placeholder="Username">
- </div>
- <label style="margin-top: 15px;">Password</label>
- <div class="input-group">
- <span class="input-group-addon"><i class="glyphicon glyphicon-lock"></i></span>
- <input id="password" type="password" class="form-control" name="password" placeholder="Password">
- </div>
- <%
- if(session.getAttribute("loginSuccessful") != null && session.getAttribute("loginSuccessful") == "false") {
- %>
- <div class="alert alert-danger" style="margin-top: 10px;">
- <strong>Wrong username and password combination.</strong> Please, check your login information and try again.
- </div>
- <%
- }
- %>
- <button type="submit" class="btn btn-default login-btn" >Login</button>
- </form>
- </div>
- </div>
- </div>
- </body>
- @Override
- protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
- String username = request.getParameter("username");
- String password = request.getParameter("password");
- HttpSession session = request.getSession();
- //Check login
- Boolean successful = CheckLogin(username,password);
- if (successful) {
- response.sendRedirect("Environments.jsp");
- }
- else {
- session.setAttribute("loginSuccessful","false");
- response.sendRedirect("index.jsp");
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement