Viewing File: /usr/local/cpanel/whostmgr/docroot/templates/changehostname.tmpl

[%
    WRAPPER 'master_templates/master.tmpl'
        theme   = 'bootstrap',
        app_key = 'change_hostname'
-%]
[% IF data.update_in_progress %]
<div class="alert alert-warning">
    <span class="glyphicon glyphicon-exclamation-sign"></span>
    <div class="alert-message">
        <strong>[% locale.maketext('Warning:') %]</strong> [% locale.maketext('Your previous attempt to change the hostname is still running. Please wait until it completes.') %]
    </div>
</div>
[% END %]

<div class="col-xs-12 col-sm-6">
    <div id="brick2" class="panel panel-default">
        <div class="panel-heading">
            [% locale.maketext("Instructions") %]
        </div>
        <div class="panel-body">
            [% locale.maketext("It is important to choose a hostname that you will not be using for any account.") %]
            [% locale.maketext("Do not choose a potential service subdomain as a hostname (for example, [asis,cpanel.example.com] or [asis,whm.example.com]).") %]
            [% locale.maketext("You should choose something that will be socially acceptable, as it will appear in all mail headers.") %]
            [% locale.maketext("Choose a hostname that is 60 characters or fewer.") %]
            [% locale.maketext("Your hostname must be a [output,acronym,FQDN,Fully Qualified Domain Name].") %]
            [% locale.maketext("In English, a hostname should consist of a name and a domain name.") %]
            [% locale.maketext("All valid hostnames should have 2 dots in them.") %]
            [% locale.maketext("Hostnames should never begin with “[asis,www]”.") %]
            [% locale.maketext("Hostnames should also not begin with a digit, nor end with a hyphen (“-”).") %]
            [% locale.maketext("Only use lowercase, Latin-script letters in hostnames.") %]
        </div>
    </div>
[% IF data.display_virtual_warn %]
    <div id="brick6" class="panel panel-info">
        <div class="panel-heading">
            <span class="glyphicon glyphicon-exclamation-sign"></span>
            [% locale.maketext("Note for cloud hosted or virtualized servers") %]
        </div>
        <div class="panel-body">
            [% locale.maketext("To provision and rename servers, many cloud hosting providers use utilities that may interfere with this function.") %]
            [% locale.maketext("This conflict may cause hostname configuration issues and result in a locked [asis,cPanel amp() WHM] license.") %]
            [% locale.maketext("For more information about this problem and instructions for how to resolve it, read [output,url,_1,our Knowledgebase article,target,_blank].","https://go.cpanel.net/cloudhostname") %]
        </div>
    </div>
[% END %]
    <div id="brick1" class="panel panel-info">
        <div class="panel-heading">
            [% locale.maketext("Current Hostname") %]
        </div>
        <div class="panel-body">
            [% data.hostname %]
        </div>
    </div>
    <div id="brick5" class="panel panel-primary">
        <div class="panel-heading">
            <div>[% locale.maketext("Change Hostname") %]</div>
        </div>
        <div class="panel-body">
            <form class="layout-medium"
                  onSubmit="return checkhostname()"
                  action="[% cp_security_token %]/scripts2/dochangehostname"
                  name="fqdnform">

                <div class="form-group">
                    <div class="row">
                        <div class="col-xs-12 col-sm-6">
                            <label for="txtHostname">
                                [% locale.maketext("New Hostname:") %]
                            </label>

                        </div>
                        <div class="col-xs-12 col-sm-6">
                        </div>
                    </div>
                    <div class="row">
                        <div class="col-xs-12 col-sm-6">
                            <input size="60" maxlength="255" type="text" name="hostname" id="txtHostname" class="form-control" value="[% data.hostname %]" [% IF data.update_in_progress %]disabled='disabled'[%END%]>
                        </div>
                        <div class="col-xs-12 col-sm-6">
                        </div>
                    </div>
                </div>
                <button type="submit" class="btn btn-primary" id="btnChange" [% IF data.update_in_progress %]disabled='disabled'[%END%]>
                    [% locale.maketext('Change') %]
                </button>
            </form>
        </div>
    </div>
</div>

<div class="col-xs-12 col-sm-6">
    <div id="brick3" class="panel panel-default">
        <div class="panel-heading">
            [% locale.maketext("Sample Hostnames") %]
        </div>
        <div class="panel-body">
            <ul>
                <li>fred.em445webhosting.com</li>
                <li>gravity.mywebhostnew.com</li>
                <li>rr4.rrhosting.com</li>
            </ul>
        </div>
    </div>
</div>

<script>
function checkhostname() {
    var hostname = document.fqdnform.hostname.value;
    if (hostname == '') {
        alert("[% locale.maketext("Your hostname cannot be null.") %]");
        return false;
    }
    if (hostname.indexOf(' ') > -1) {
        alert("[% locale.maketext("Your hostname cannot contain any spaces.") %]");
        return false;
    }
    if (hostname.indexOf('.') == -1) {
        alert("[% locale.maketext("Your hostname must contain at least two periods.") %]");
        return false;
    }
    if (hostname.length < 8) {
        alert("[% locale.maketext("Your hostname cannot be less than eight characters.") %]");
        return false;
    }
    var pattern = /(?:^[.]|[.]$)/;
    if (hostname.match(pattern) != null) {
        alert("[% locale.maketext("Your hostname cannot begin or end with a period.") %]");
        return false;
    }
    var pattern = /(?:^[-]|[-]$)/;
    if (hostname.match(pattern) != null) {
        alert("[% locale.maketext("Your hostname cannot begin or end with a hyphen.") %]");
        return false;
    }
    var pattern = /^www[.]/i;
    if (hostname.match(pattern) != null) {
        alert("[% locale.maketext("Your hostname cannot begin with “[asis,www]”.") %]");
        return false;
    }
    var hostnamearray = hostname.split('.');
    if (hostnamearray.length < 3) {
        alert("[% locale.maketext("Your hostname must contain at three unique sections split by periods.") %]");
        return false;
    }
    return true;
}
</script>
[% END #wrapper -%]
Back to Directory File Manager