Added whitelist pages
This commit is contained in:
parent
a4eb5c613d
commit
d6bd76e408
5 changed files with 41 additions and 20 deletions
|
|
@ -20,9 +20,12 @@ import java.util.logging.Logger;
|
|||
public class LoginServlet extends ZalleryServlet {
|
||||
private static Logger logger = LogUtil.getLogger();
|
||||
|
||||
public static final String URI = "/login";
|
||||
public static final String URI = "/login";
|
||||
private static final String JSP_FILE = "page_login.jsp";
|
||||
|
||||
private static final String FORM_EMAIL = "email";
|
||||
private static final String FORM_PASSWORD = "password";
|
||||
|
||||
|
||||
public void doGet(HttpServletRequest request, HttpServletResponse response, DBConnection db) throws ServletException, IOException, SQLException {
|
||||
// User already logged in?
|
||||
|
|
@ -34,10 +37,10 @@ public class LoginServlet extends ZalleryServlet {
|
|||
|
||||
// Forward user
|
||||
if (user != null) {
|
||||
include(JSP_FILE, request, response);
|
||||
} else {
|
||||
logger.fine("User(" + user.getEmail() + ") already authenticated, forwarding to gallery.");
|
||||
redirect(GalleryServlet.URI, request, response);
|
||||
} else {
|
||||
include(JSP_FILE, request, response);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -45,8 +48,8 @@ public class LoginServlet extends ZalleryServlet {
|
|||
public void doPost(HttpServletRequest request, HttpServletResponse response, DBConnection db) throws SQLException, ServletException, IOException {
|
||||
UserMessage msgs = UserMessage.getUserMessage(request.getSession());
|
||||
User user = AuthenticationManager.authenticate(db,
|
||||
request.getParameter("email"),
|
||||
request.getParameter("password"),
|
||||
request.getParameter(FORM_EMAIL),
|
||||
request.getParameter(FORM_PASSWORD),
|
||||
request, response);
|
||||
|
||||
// Successful login
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue