Viewing File: /usr/local/cpanel/base/unprotected/nc-cpanel/templates/resetpass_no_user.tmpl

[%
SET reset_url = "/resetpass";
IF !https;
USE ApplicationUrl;
SET secure_url = ApplicationUrl.get_secure_url(
    host            => SERVER_NAME,
    port            => SERVER_PORT,
    proxysubdomains => cpconf.proxysubdomains);
SET reset_url = secure_url _ reset_url;
END;
%]
<div id="reset-forms" class="login-container__login-form login-form">
    <a href="/" class="btn btn--link login-form__back-link mb-32">Reset Password</a>

    [% IF !https %]
    <form id="reload_form" action="[% reset_url %]">
        [% IF CPANEL.is_debug_mode_enabled() %]
            <input type="hidden" name="debug" value="1">
        [% END %]
        <input type="hidden" name="start" value="1">
        <div class="alert alert-warning">
            <span class="fas fa-2x fa-exclamation-triangle" aria-hidden="true"></span>
            <div class="alert-message">
                <strong>[% locale.maketext('Warning:') %]</strong>
                [% locale.maketext('The Reset Password feature only supports the [asis,HTTPS] protocol.') %]
            </div>
        </div>
        <div class="controls login-form__controls">
            <div class="login-btn">
                <input id="login" type="submit" value="[% locale.maketext('Reload with [asis,HTTPS]') %]">
            </div>
        </div>
        <div class="controls login-form__controls">
            <div class="reset-pw">
                <a href="/">[% locale.maketext('Cancel') %]</a>
            </div>
        </div>
        <div class="clear"></div>
    </form>
    [% ELSE %]
    <form id="reset_form" action="/resetpass" method="POST">
        <!-- Prevent submit via Enter if submit button is disabled -->
        <input style="display:none" />

        [% IF CPANEL.is_debug_mode_enabled() %]
            <input type="hidden" name="debug" value="1">
        [% END %]

        <div class="input-req-login login-form__label">
            <label for="username">[% locale.maketext('Username') %]</label>

            <div class="tooltip" data-gb-tooltip-placement="right">
                <div class="tooltip__toggle tooltip__toggle--icon"></div>
                <div class="tooltip__wrap">
                    <div class="tooltip__arrow"></div>
                    <div class="tooltip__content">
                        <p>Your cPanel username should differ from your Namecheap username. Your cPanel login details can be found in your Welcome Email.</p>
                    </div>
                </div>
            </div>
        </div>
        <div class="input-field-login icon username-container login-form__input">
            <input name="user" id="username" placeholder="[% IF app_name=="webmaild" %][% locale.maketext('Enter your email address.') %][% ELSE %][% locale.maketext('Enter your cPanel username') %][% END %]" type="text"  autocomplete="off" class="std_textbox form-control" tabindex="1" required autofocus >
            <p class="login-form__remark">The username should not have any spaces, uppercase or special characters.</p>
        </div>
        <div class="controls login-form__controls">
            <div class="login-btn">
                <button name="login" type="submit" class="login-form__submit btn btn--red btn--block" id="login" tabindex="3">[% locale.maketext('Reset Password') %]</button>
            </div>
            <div class="reset-pw">
                <a href="/" class="login-form__reset-pass btn btn--link">[% locale.maketext('Cancel') %]</a>
            </div>
        </div>

        <div class="clear"></div>

        <script type="text/javascript">
            window.onload = function () {
                var submit = document.getElementById('login');
                submit.setAttribute('disabled', true);

                var input = document.getElementById('username');
                input.addEventListener('input', validateInput);
                input.addEventListener('propertychange', validateInput); // for IE8

                function validateInput() {
                    var reUserName = /^(?=.{1,16}$)(?![_.0-9])(?!.*[_.]{2})[a-z0-9]+$/;
                    // ?=.{4,20}$) username is 1-16 characters long
                    // (?![_.0-9])  no _ or . at the beginning
                    // (?!.*[_.]{2}) no __ or _. or ._ or .. inside
                    // [a-z0-9] allowed characters
                    // Username cannot begin with a number, or the string 'test'. Or end with the string 'assword'
                    var val = this.value;
                    if (!reUserName.test(val) || val.startsWith("test") || val.endsWith("assword")) {
                        this.classList.add('is-error');
                        submit.setAttribute('disabled', true)
                    } else {
                        this.classList.remove('is-error');
                        submit.removeAttribute('disabled')
                    }
                }
            };
        </script>
    </form>
    [% END %]
    <span id="resetpass-no-user">[%# marker for testing%]</span>
</div>
Back to Directory File Manager