JARCH SHOWCASE
JARCH SHOWCASE
Dialog - Login Demo This example demonstrates how to create a login dialog. Correct combination is (admin-admin)
Login
<a:form>
    <h:outputLink value="javascript:void(0)" onclick="PF('dlg').show();" title="login">
        <a:graphicImage name="/demo/images/login.png" />
    </h:outputLink>

    <a:growl id="growl" sticky="true" showDetail="true" life="3000" />

    <a:dialog header="Login" widgetVar="dlg" resizable="false">
        <h:panelGrid columns="2" cellpadding="5">
            <h:outputLabel for="username" value="Username:" />
            <a:inputText id="username" value="#{userLoginView.username}" required="true" label="username" />

            <h:outputLabel for="password" value="Password:" />
            <a:password id="password" value="#{userLoginView.password}" required="true" label="password" />

            <f:facet name="footer">
                <a:commandButton value="Login" update="growl" actionListener="#{userLoginView.login}"
                                 oncomplete="handleLoginRequest(xhr, status, args)" />
            </f:facet>  
        </h:panelGrid>
    </a:dialog>
</a:form>

<script type="text/javascript">
    function handleLoginRequest(xhr, status, args) {
        if(args.validationFailed || !args.loggedIn) {
            PF('dlg').jq.effect("shake", {times:5}, 100);
        }
        else {
            PF('dlg').hide();
            $('#loginLink').fadeOut();
        }
    }
</script>
                
JARCH, Copyright © 2022 All rights reserved. Running JARCH 24.3.0-SNAPSHOT on PrimeFaces-12.0.0 on Mojarra-2.3.13.