Examples of LoginForm


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

Examples of com.ateam.webstore.ui.forms.LoginForm

       */
      public LoginForm getLoginRequest() {
       
        l.info("Parsing Login Request from session "+req.getSession().getId());
       
        LoginForm login = new LoginForm();
        Visitor v = new Visitor();
        v.setEmail(req.getParameter(Parameters.EMAIL.getId()));
        login.setVisitor(v);
        login.setPassword(req.getParameter(Parameters.PASSWORD.getId()));
       
        req.getSession().setAttribute(SESSION_ATTRIBUTE_VISITOR, v);
        login.setVisitor(v);
        login.setForm(FormName.LOGIN);
        login.setRedirect(req.getParameter(Parameters.REDIRECT.getId()));
       
        return login;
      }
View Full Code Here

Examples of com.company.ui.login.LoginForm

        boolean isAuthenticated = RequestUtils.getSession(html).getBoolean("authenticated", false);
       
        if (isAuthenticated) {
            html.h1().content("Hello " + RequestUtils.getSession(html).getString("user"));
        } else {
            html.render(new LoginForm());
        }
       
        html.h4().content("quickstart example app using renderSnake and Google Guice");
    }
View Full Code Here

Examples of com.company.ui.login.LoginForm

        boolean isAuthenticated = RequestUtils.getSession(html).getBoolean("authenticated", false);
       
        if (isAuthenticated) {
            html.h1().content("Hello " + RequestUtils.getSession(html).getString("user"));
        } else {
            html.render(new LoginForm());
        }
       
        html.h4().content("quickstart example app using renderSnake and Spring MVC");
    }
View Full Code Here

Examples of com.company.ui.login.LoginForm

        boolean isAuthenticated = html.getSession().getBoolean("authenticated", false);
       
        if (isAuthenticated) {
            html.h1().content("Hello " + html.getSession().getString("user"));
        } else {
            html.render(new LoginForm());
        }
       
        html.h4().content("quickstart example app using renderSnake and Google Guice");
    }
View Full Code Here

Examples of com.dotmarketing.cms.login.struts.LoginForm

        return af;
    }

    public ActionForward login(ActionMapping mapping, ActionForm lf, HttpServletRequest request,
            HttpServletResponse response) throws Exception {
        LoginForm form = (LoginForm) lf;

        /**
         * referrer can be used to have diferent login forms in diferent pages
         * so referer has to be set (as a hidden input) in the login form page to return there in case of an error or
         * success (the sucess url can be overriden by setting the session REDIRECT_AFTER_LOGIN property in the login form as well)
         */
        String referrer = null;
    if (request.getAttribute("referrer") != null && !request.getAttribute("referrer").toString().equalsIgnoreCase(""))
    {
      referrer = (String)request.getAttribute("referrer");
    }
    else if (request.getParameter("referrer") != null && !request.getParameter("referrer").toString().equalsIgnoreCase(""))
    {
      referrer = SecurityUtils.stripReferer(request, (String)request.getParameter("referrer"));
    }

    try {

          if (LoginFactory.doLogin(form, request, response)) {

            if(!UtilMethods.isSet(referrer))
              referrer = "/";

              User u = (User) request.getSession().getAttribute(WebKeys.CMS_USER);

              List<Role> userRoles = com.dotmarketing.business.APILocator.getRoleAPI().loadRolesForUser(u.getUserId());
              Role defaultRole = com.dotmarketing.business.APILocator.getRoleAPI().loadRoleByKey(Config.getStringProperty("CMS_VIEWER_ROLE"));
              if (!userRoles.contains(defaultRole)) {
                com.dotmarketing.business.APILocator.getRoleAPI().addRoleToUser(defaultRole.getId(), u);
              }

              UserProxy userproxy = com.dotmarketing.business.APILocator.getUserProxyAPI().getUserProxy(u,APILocator.getUserAPI().getSystemUser(), false);
              if (UtilMethods.isSet(userproxy.getLongLivedCookie())) {
                //reset cookie in request
                Cookie cookie = UtilMethods.getCookie(request.getCookies(), WebKeys.LONG_LIVED_DOTCMS_ID_COOKIE);
                if (cookie != null) {
                  cookie.setMaxAge(-1);
                  cookie.setPath("/");
                      response.addCookie(cookie);
                }
              }
              else {
              String _dotCMSID = "";
              if(!UtilMethods.isSet(UtilMethods.getCookieValue(request.getCookies(),
                  com.dotmarketing.util.WebKeys.LONG_LIVED_DOTCMS_ID_COOKIE))) {
                Cookie idCookie = CookieUtil.createCookie();

              }
              _dotCMSID = UtilMethods.getCookieValue(request.getCookies(),
                  com.dotmarketing.util.WebKeys.LONG_LIVED_DOTCMS_ID_COOKIE);
              userproxy.setLongLivedCookie(_dotCMSID);

              }

              request.getSession().removeAttribute(WebKeys.PENDING_ALERT_SEEN);

              if (request.getSession().getAttribute(WebKeys.REDIRECT_AFTER_LOGIN) != null) {
                  String redir = (String) request.getSession().getAttribute(WebKeys.REDIRECT_AFTER_LOGIN);
                  request.removeAttribute(WebKeys.REDIRECT_AFTER_LOGIN);
                  Logger.debug(this.getClass(), "redirecting after account creation: " + redir);
                  ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, redir));
                  af.setRedirect(true);
                  return af;
              }

          ActionMessages msg = new ActionMessages();
              msg.add(Globals.MESSAGE_KEY, new ActionMessage("message.Login.Successful"));
              request.setAttribute(Globals.MESSAGE_KEY, msg);

              ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, referrer));
              af.setRedirect(true);
              return af;
          }
          else if (isUserInactive(form, request)) {
            return mapping.findForward("resendActivationPage");
          }

          Logger.debug(this, "Failed login redirecting to: " + referrer);
          ActionErrors errors = new ActionErrors();
          errors.add(Globals.ERROR_KEY, new ActionMessage("errors.password.mismatch"));
          request.getSession().setAttribute(Globals.ERROR_KEY, errors);

          if(referrer != null && !referrer.equals("/")) {
            ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, referrer));
            af.setRedirect(true);
            return af;
          } else {
            if (!Config.getBooleanProperty("USE_CHALLENGE_QUESTION")) {
                if(referrer != null && !referrer.equals("/")) {
                  ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, referrer));
                  af.setRedirect(true);
                  return af;
                } else
                  return mapping.findForward("loginPage");
            } else {
              User user = null;
                Company company = PublicCompanyFactory.getDefaultCompany();
              if (company.getAuthType().equals(Company.AUTH_TYPE_EA)) {
                user = APILocator.getUserAPI().loadByUserByEmail(form.getUserName().toLowerCase(), APILocator.getUserAPI().getSystemUser(), false);
                } else {
                  user = APILocator.getUserAPI().loadUserById(form.getUserName().toLowerCase(),APILocator.getUserAPI().getSystemUser(),false);
                }
              ActionForward af = new ActionForward(SecurityUtils.stripReferer(request, mapping.findForward("challengeQuestionPage").getPath() + "?emailAddress=" + user.getEmailAddress()));

              return af;
            }
View Full Code Here

Examples of com.form.LoginForm

@Controller
@RequestMapping("loginform.html")
public class LoginController {
  @RequestMapping(method = RequestMethod.GET)
  public String showForm(Map model) {
    LoginForm loginForm = new LoginForm();
    model.put("loginForm", loginForm);
    return "loginform";
  }
View Full Code Here

Examples of com.projity.dialog.LoginForm

        if (login==null||password==null){
          try {
            loginUrl=new URL(serverUrl+"/login");
          } catch (MalformedURLException e) {}
        }
        LoginForm form = LoginDialog.doLogin(graphicManager.getFrame(),loginUrl); // it's actually a singleton
        if (form.isCancelled())
          System.exit(-1);
        if (form.isUseMenus())
          Environment.setNewLook(false);

        login=form.getLogin();
        password=form.getPassword();
      }

      if ("_SA".equals(login)||Environment.getStandAlone()) {// for testing purposes!
        Environment.setStandAlone(true);
        Environment.setUser(new DefaultUser());
View Full Code Here

Examples of com.vaadin.ui.LoginForm

    public static class LoginFormWindow extends LegacyWindow {
        public LoginFormWindow() {
            super();

            LoginForm loginForm = new LoginForm();
            loginForm.setSizeUndefined();

            loginForm.addListener(new LoginListener() {

                private static final long serialVersionUID = 1L;

                @Override
                public void onLogin(LoginEvent event) {
View Full Code Here

Examples of com.vaadin.ui.LoginForm

    @Override
    protected void setup() {
        loginFormLayout = new HorizontalLayout();

        loginForm = new LoginForm();
        loginForm.setSizeUndefined();

        updateCaption();
        loginForm.addListener(new LoginListener() {
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.