Package cn.edu.zju.acm.onlinejudge.form

Examples of cn.edu.zju.acm.onlinejudge.form.LoginForm


     *             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);
        }

View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.form.LoginForm

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.