* any errors happened
*/
@Override
public ActionForward execute(ActionMapping mapping, ActionForm form, ContextAdapter context) throws Exception {
LoginForm loginForm = (LoginForm) form;
String forwardPath = context.getRequest().getParameter("forward");
if (loginForm.getHandle() == null) {
context.setAttribute("forward", forwardPath);
return this.handleSuccess(mapping, context, "failure");
}
ActionMessages errors = this.authenticate(loginForm, context);
if (errors.size() > 0) {
context.setAttribute("forward", forwardPath);
return this.handleFailure(mapping, context, errors);
}
if (loginForm.isRememberMe()) {
Cookie ch = new Cookie("oj_handle", loginForm.getHandle());
ch.setMaxAge(3600 * 24 * 30);
ch.setPath("/");
context.getResponse().addCookie(ch);
Cookie cp = new Cookie("oj_password", loginForm.getPassword());
cp.setMaxAge(3600 * 24 * 30);
cp.setPath("/");
context.getResponse().addCookie(cp);
}