How to create a login page

Many webhosts want to make an easy one stop location for logging into DirectAdmin. This can be accomplished by adding a login form on your webpage. Replace with your domain. It's fairly simple to do, just add the following code to your website:

<style>
    *{ FONT-SIZE: 8pt; FONT-FAMILY: verdana; }
    b { FONT-WEIGHT: bold; }
    .listtitle { BACKGROUND: #425984; COLOR: #EEEEEE; white-space: nowrap; }
    td.list { BACKGROUND: #EEEEEE; white-space: nowrap; }
</style>
<table cellspacing=1 cellpadding=5>
<tr>
    <td class=listtitle colspan=2>Please enter your Username and Password</td>
</tr>
<form action="https://yourdomain.com:2222/CMD_LOGIN" method="POST" name="form">
<input type=hidden name=referer value="/">
<input type=hidden name=FAIL_URL value="https://yourdomain.com/login_failed.html">
<input type=hidden name=LOGOUT_URL value="https://yourdomain.com/logged_out.html">

<tr>
    <td class=list align=right>Username:</td><td class=list><input type=text name=username></td>
</tr>
<tr>
    <td class=list align=right>Password:</td><td class=list><input type=password name=password></td>
</tr>
<tr>
    <td class=listtitle align=right colspan=2><input type=submit value='Login'></td>
</tr>
</form>
</table>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26

Also included in this form are the optional FAIL_URL and LOGOUT_URL values. You can set them so that if a user enters a wrong username or password, the login_failed.html will be shown, and when they hit "Logout" from within DirectAdmin, they'll be taken to the logged_out.html page. You can change the values as needed. If you remove those 2 options, then the default DA settings will take over. Both the login_failed.html and logged_out.html would be stored on your own website, and not through DA (as set, in this example).

If you want the login page to go straight to a particular page, you can change the "referer" value from "/" to "/CMD_USER_STATS" for example, if you wanted it to go straight to the statistics page upon successful login.

A related feature exists to change the DirectAdmin Login page itself: http://www.directadmin.com/features.php?id=250open in new window

How to change the appearance of login page

If a skin creates the file login.html in its top level directory, e.g.,

/usr/local/directadmin/data/skins/enhanced/login.html

then whatever skin is set in the directadmin.conf for

docsroot=./data/skins/enhanced
1

will be searched for that login.html, and used if it exists.

The priority order is:

  1. /usr/local/directadmin/data/templates/custom/login.html
  2. /usr/local/directadmin/data/templates/login.html
  3. ${docsroot}/login.html
  4. internal login page

Similarly, you can now create your own skin's "login_images" path, e.g., /usr/local/directadmin/data/skins/enhanced/login_images/logo.png.

If you want to change the look of the login page when you access port 2222, use this feature to create your own login.html file:
http://www.directadmin.com/features.php?id=250open in new window

Also, if you need to host your own images on that login page, use this feature:
http://www.directadmin.com/features.php?id=609open in new window

Last Updated: 6/23/2021, 9:36:08 PM