1 40 package org.dspace.app.webui.servlet; 41 42 import java.io.IOException ; 43 import java.sql.SQLException ; 44 45 import javax.servlet.ServletException ; 46 import javax.servlet.http.HttpServletRequest ; 47 import javax.servlet.http.HttpServletResponse ; 48 49 import org.apache.log4j.Logger; 50 import org.dspace.app.webui.util.Authenticate; 51 import org.dspace.app.webui.util.JSPManager; 52 import org.dspace.authorize.AuthorizeException; 53 import org.dspace.core.Context; 54 import org.dspace.core.LogManager; 55 import org.dspace.eperson.EPerson; 56 import org.dspace.eperson.AuthenticationManager; 57 import org.dspace.eperson.AuthenticationMethod; 58 59 70 public class PasswordServlet extends DSpaceServlet 71 { 72 73 private static Logger log = Logger.getLogger(PasswordServlet.class); 74 75 protected void doDSGet(Context context, HttpServletRequest request, 76 HttpServletResponse response) throws ServletException , IOException , 77 SQLException , AuthorizeException 78 { 79 JSPManager.showJSP(request, response, "/login/password.jsp"); 81 } 82 83 protected void doDSPost(Context context, HttpServletRequest request, 84 HttpServletResponse response) throws ServletException , IOException , 85 SQLException , AuthorizeException 86 { 87 String email = request.getParameter("login_email"); 89 String password = request.getParameter("login_password"); 90 String jsp = null; 91 92 int status = AuthenticationManager.authenticate(context, email, password, 94 null, request); 95 96 if (status == AuthenticationMethod.SUCCESS) 97 { 98 Authenticate.loggedIn(context, request, context.getCurrentUser()); 100 101 log.info(LogManager.getHeader(context, "login", "type=explicit")); 102 103 Authenticate.resumeInterruptedRequest(request, response); 105 106 return; 107 } 108 else if (status == AuthenticationMethod.CERT_REQUIRED) 109 jsp = "/error/require-certificate.jsp"; 110 else 111 jsp = "/login/incorrect.jsp"; 112 113 log.info(LogManager.getHeader(context, "failed_login", 115 "email=" + email + ", result=" + String.valueOf(status))); 116 JSPManager.showJSP(request, response, jsp); 117 } 118 } 119 | Popular Tags |