Login Box

Example Login Box: 

The wtPage hidden field will be where the user will be redirected after a successful login

<wt:if test="![wt:wt.currentuser.ismember]">
        <script type="text/javascript" src="?wtInclude=md5.js"></script>
        <script language="javascript">
                <!--

                function login(theForm)
                {
                        var newPassword = '';
                        var i = 0;
                        theForm.passwordhash.value = hex_md5(theForm.challenge.value + hex_md5(theForm.username.value + '<?= WTSYSTEMSALT ?>' + theForm.password.value));
                        for(i = 0; i < theForm.password.value.length; i++) {
                                newPassword += '*';
                        }

                        theForm.password.value = newPassword;
                        return true;
                }

                //-->
        </script>

        <form method="post" action="[wt:wt.uri]" onsubmit="return login(this)"/>
                <input type="hidden" name="wtCmd" value="login"/>
                <input type="hidden" name="wtPage" value="account"/>
                <input type="hidden" name="passwordhash" value=""/>
                <input type="hidden" name="challenge" value="<?= $GLOBALS["WT"]->GetAuthChallenge() ?>"/>

                <wt:if test="[wt:wt.request.result] == 'error'">
                        <strong class="required">Username or Password Incorrect</strong><br/>
                </wt:if>
                <input name="username" id="username" class="textinput" value="username"/>&nbsp;&nbsp;
                <input name="password" type="password" id="password" class="textinput" value="********"/>&nbsp;&nbsp;
                <input type="submit" value="Login" class="formbutton"/>&nbsp;&nbsp;
                <!--a href="forgotten-password">Forgotten your password?</a>&nbsp;&nbsp;<a href="[wt:wt.site.base]website-member-signup">Signup here</a-->
        </form>
</wt:if>

<wt:if test="[wt:wt.currentuser.ismember]">
        <form method="post" action="[wt:wt.uri]" id="logoutForm">
                <input type="hidden" name="wtPage" value="[wt:wt.site.base]"/>
                <input type="hidden"  name="wtCmd" value="logout"/>
                <input type="submit" class="formbutton" value="Logout"/>
        </form>
        <span class="logoutText">You are logged in as [wt:wt.currentuser.First Name] [wt:wt.currentuser.Last Name] (<a href="[wt:wt.site.base]account" title="View Account">view account</a>)</span>
</wt:if>