Added login redirect
This commit is contained in:
parent
eafb34d2c2
commit
af6e662aae
3 changed files with 20 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ import zall.Zallery;
|
|||
import zall.ZalleryServlet;
|
||||
import zall.bean.User;
|
||||
import zall.manager.AuthenticationManager;
|
||||
import zutil.ObjectUtil;
|
||||
import zutil.db.DBConnection;
|
||||
import zutil.log.LogUtil;
|
||||
import zutil.ui.UserMessageManager;
|
||||
|
|
@ -17,6 +18,8 @@ import java.io.IOException;
|
|||
import java.sql.SQLException;
|
||||
import java.util.logging.Logger;
|
||||
|
||||
import static zall.ZalleryConstants.SESSION_KEY_LOGIN_FRWD;
|
||||
|
||||
|
||||
@WebServlet(LoginServlet.URI)
|
||||
public class LoginServlet extends ZalleryServlet {
|
||||
|
|
@ -40,7 +43,11 @@ public class LoginServlet extends ZalleryServlet {
|
|||
// Forward user
|
||||
if (user != null) {
|
||||
logger.fine("User(" + user.getEmail() + ") already authenticated, forwarding to gallery.");
|
||||
redirect(GalleryServlet.URI, request, response);
|
||||
|
||||
if (ObjectUtil.isEmpty(request.getSession().getAttribute(SESSION_KEY_LOGIN_FRWD)))
|
||||
redirect((String)request.getSession().getAttribute(SESSION_KEY_LOGIN_FRWD), request, response);
|
||||
else
|
||||
redirect(GalleryServlet.URI, request, response);
|
||||
} else {
|
||||
include(JSP_FILE, request, response);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue