{extends "base.tpl.html"}
{block "title"}Request a Password{/block}

{block "content"}
<br /><br />

<script type="text/javascript">
    <!--
    function validateForm(f)
    {
        if (Validation.isWhitespace(f.email.value)) {
            alert('{t escape=js}Please enter your account email address.{/t}');
            Validation.selectField('email');
            return false;
        }
        return true;
    }
    //-->
</script>

{if $result|default:'' == ''}
<div class="yellow_note">
{t}Note: Please enter your email address below and a new random password will be created and assigned to your account. For security purposes a confirmation message will be sent to your email address and after confirming it the new password will be then activated and sent to you.{/t}
</div>
{/if}
<br />
<form name="email_form" onSubmit="return validateForm(this);" method="post" action="">
    <input type="hidden" name="cat" value="reset_password">
    <table class="bordered narrow">
        <tr class="title">
            <th colspan="2">
                {t}Request a Password{/t}
            </th>
        </tr>
        {if $result|default:'' != 0}
        <tr>
            <td colspan="2" class="error">
                    {if $result == -1}
                    {t}Error: An error occurred while trying to run your query.{/t}
                    {elseif $result == 1}
                    {t}Thank you, a confirmation message was just emailed to you. Please follow the instructions available in this message to confirm your password creation request.{/t}

                    {elseif $result == 3}
                    {t}Error: Your user status is currently set as inactive. Please contact your local system administrator for further information.{/t}
                    {elseif $result == 4}
                    {t}Error: Please provide your email address.{/t}
                    {elseif $result == 5}
                    {t}Error: No user account was found matching the entered email address.{/t}
                    {/if}
            </td>
        </tr>
        {else}
        <tr>
            <th width="40%">{t}Email Address{/t}</th>
            <td width="60%">
                <input accessKey="e" type="text" name="email" value="{$email|default:$smarty.get.email|default:''|escape:"html"}" size="30" maxlength="100">
                {include file="error_icon.tpl.html" field="email"}
            </td>
        </tr>
        <tr class="buttons">
            <td colspan="2">
                <input type="submit" name="Submit" value="{t}Send New Password{/t}">
            </td>
        </tr>
        {/if}
        <tr>
            <td colspan="2">
                <a href="index.php">{t}Back to Login Form{/t}</a>
            </td>
        </tr>
    </table>
</form>
{/block}
