Example usage for com.liferay.portal.kernel.util PortletKeys FAST_LOGIN

List of usage examples for com.liferay.portal.kernel.util PortletKeys FAST_LOGIN

Introduction

In this page you can find the example usage for com.liferay.portal.kernel.util PortletKeys FAST_LOGIN.

Prototype

String FAST_LOGIN

To view the source code for com.liferay.portal.kernel.util PortletKeys FAST_LOGIN.

Click Source Link

Usage

From source file:com.liferay.login.web.internal.servlet.taglib.include.AnonymousNavigationPrePageInclude.java

License:Open Source License

@Override
public void include(PageContext pageContext) throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String mvcRenderCommandName = request.getParameter("mvcRenderCommandName");

    if ((mvcRenderCommandName != null) && mvcRenderCommandName.startsWith("/login/create_anonymous_account")) {

        return;/*from  ww w.j ava  2 s  .co  m*/
    }

    PortletConfig portletConfig = (PortletConfig) request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);

    String portletName = portletConfig.getPortletName();

    if (!portletName.equals(PortletKeys.FAST_LOGIN)) {
        return;
    }

    RenderURLTag renderURLTag = new RenderURLTag();

    renderURLTag.setPageContext(pageContext);

    renderURLTag.addParam("mvcRenderCommandName", "/login/create_anonymous_account");
    renderURLTag.setVar("anonymousURL");
    renderURLTag.setWindowState(WindowState.MAXIMIZED.toString());

    renderURLTag.doTag(pageContext);

    String anonymousURL = (String) pageContext.getAttribute("anonymousURL");

    IconTag iconTag = new IconTag();

    iconTag.setIconCssClass("icon-user");
    iconTag.setMessage("guest");
    iconTag.setUrl(anonymousURL);

    iconTag.doTag(pageContext);
}

From source file:com.liferay.login.web.internal.servlet.taglib.include.CreateAccountNavigationPostPageInclude.java

License:Open Source License

@Override
public void include(PageContext pageContext) throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String mvcRenderCommandName = request.getParameter("mvcRenderCommandName");

    if ("/login/create_account".equals(mvcRenderCommandName)) {
        return;//w ww. j av a  2 s .  c  o  m
    }

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    Company company = themeDisplay.getCompany();

    if (!company.isStrangers()) {
        return;
    }

    PortletConfig portletConfig = (PortletConfig) request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);

    String portletName = portletConfig.getPortletName();

    if (portletName.equals(PortletKeys.FAST_LOGIN)) {
        return;
    }

    IconTag iconTag = new IconTag();

    iconTag.setIconCssClass("icon-plus");
    iconTag.setMessage("create-account");

    try {
        iconTag.setUrl(_portal.getCreateAccountURL(request, themeDisplay));
    } catch (Exception e) {
        throw new JspException(e);
    }

    iconTag.doTag(pageContext);
}

From source file:com.liferay.login.web.internal.servlet.taglib.include.SignInNavigationPrePageInclude.java

License:Open Source License

@Override
public void include(PageContext pageContext) throws JspException {
    HttpServletRequest request = (HttpServletRequest) pageContext.getRequest();

    String mvcRenderCommandName = request.getParameter("mvcRenderCommandName");

    if (Validator.isNull(mvcRenderCommandName) || "/login/login".equals(mvcRenderCommandName)) {

        return;//from   w ww .  jav  a2 s  .  c  om
    }

    ThemeDisplay themeDisplay = (ThemeDisplay) request.getAttribute(WebKeys.THEME_DISPLAY);

    String signInURL = themeDisplay.getURLSignIn();

    PortletConfig portletConfig = (PortletConfig) request.getAttribute(JavaConstants.JAVAX_PORTLET_CONFIG);

    String portletName = portletConfig.getPortletName();

    if (portletName.equals(PortletKeys.FAST_LOGIN)) {
        PortletURL fastLoginURL = PortletURLFactoryUtil.create(request, PortletKeys.FAST_LOGIN,
                PortletRequest.RENDER_PHASE);

        fastLoginURL.setParameter("saveLastPath", Boolean.FALSE.toString());
        fastLoginURL.setParameter("mvcRenderCommandName", "/login/login");

        try {
            fastLoginURL.setPortletMode(PortletMode.VIEW);
            fastLoginURL.setWindowState(LiferayWindowState.POP_UP);
        } catch (PortletException pe) {
            throw new JspException(pe);
        }

        signInURL = fastLoginURL.toString();
    }

    IconTag iconTag = new IconTag();

    iconTag.setIconCssClass("icon-signin");
    iconTag.setMessage("sign-in");
    iconTag.setUrl(signInURL);

    iconTag.doTag(pageContext);
}