public static String generateLoginHtmlFragment(CmsObject cms, VaadinRequest request) throws IOException {

        LoginParameters parameters = CmsLoginHelper.getLoginParameters(cms, (HttpServletRequest)request, true);
        request.getWrappedSession().setAttribute(CmsLoginUI.INIT_DATA_SESSION_ATTR, parameters);
        byte[] pageBytes;

        pageBytes = CmsFileUtil.readFully(
            Thread.currentThread().getContextClassLoader().getResourceAsStream(
                "org/opencms/ui/login/login-fragment.html"));

        String html = new String(pageBytes, "UTF-8");
        String autocomplete = ((parameters.getPcType() == null)
            || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) ? "on" : "off";
        CmsMacroResolver resolver = new CmsMacroResolver();
        resolver.addMacro("autocompplete", autocomplete);
        if ((parameters.getPcType() == null) || parameters.getPcType().equals(CmsLoginHelper.PCTYPE_PRIVATE)) {
            resolver.addMacro(
                "hiddenPasswordField",
                "      <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >");
        }
        if (parameters.getUsername() != null) {
            resolver.addMacro("predefUser", "value=\"" + CmsEncoder.escapeXml(parameters.getUsername()) + "\"");
        }
        html = resolver.resolveMacros(html);
        return html;
    }
public static String generateLoginHtmlFragment ( CmsObject cms , VaadinRequest request ) throws IOException { LoginParameters parameters = CmsLoginHelper . getLoginParameters ( cms , ( HttpServletRequest ) request , true ) ; request . getWrappedSession ( ) . setAttribute ( CmsLoginUI . INIT_DATA_SESSION_ATTR , parameters ) ; byte [ ] pageBytes ; pageBytes = CmsFileUtil . readFully ( Thread . currentThread ( ) . getContextClassLoader ( ) . getResourceAsStream ( "org/opencms/ui/login/login-fragment.html" ) ) ; String html = new String ( pageBytes , "UTF-8" ) ; String autocomplete = ( ( parameters . getPcType ( ) == null ) || parameters . getPcType ( ) . equals ( CmsLoginHelper . PCTYPE_PRIVATE ) ) ? "on" : "off" ; CmsMacroResolver resolver = new CmsMacroResolver ( ) ; resolver . addMacro ( "autocompplete" , autocomplete ) ; if ( ( parameters . getPcType ( ) == null ) || parameters . getPcType ( ) . equals ( CmsLoginHelper . PCTYPE_PRIVATE ) ) { resolver . addMacro ( "hiddenPasswordField" , "      <input type=\"password\" id=\"hidden-password\" name=\"ocPword\" autocomplete=\"%(autocomplete)\" >" ) ; } if ( parameters . getUsername ( ) != null ) { resolver . addMacro ( "predefUser" , "value=\"" + CmsEncoder . escapeXml ( parameters . getUsername ( ) ) + "\"" ) ; } html = resolver . resolveMacros ( html ) ; return html ; }
Returns the bootstrap html fragment required to display the login dialog.<p>

@param cms the cms context
@param request the request

@return the html fragment

@throws IOException in case reading the html template fails