How to append domain prefix to the username in weblogin with the drop down option?

Aruba Employee
Aruba Employee

This article helps to automatically append domain prefix to the authentication username with the help of drop down menu in the web-login page.


Environment : Applicable to all the ClearPass Guest versions.


Create a custom web-login page and add the below code in the Header HTML.

<div align="center" width="100%">
<p><font color="FFFFFF">
    Please login to the network using your
    username and password.
</font><br /></p>
{if $errmsg}{nwa_icontext type=error}{$errmsg|escape}{/nwa_icontext}{/if}
<form method="POST" accept-charset="UTF-8" enctype="application/x-www-form-urlencoded" novalidate="novalidate">
<font color="FFFFFF"><b><label for="Domain">Domain:</label></b></font><br />
<select id ="Domain">
<!-- You could extend the below options and include the number required domains-->
  <option value="domain1">Domain1</option>
  <option value="domain2">Domain2</option>
{if $radius_weblogin.username_auth == 'anonymous'}<div style="display:none;">{/if}
<font color="FFFFFF"><b><label for="username">Username:</label></b></font><br />
<input type="text" font color="red" style="width: 200px;" autocapitalize="off" autocorrect="off" spellcheck="false" id="username" name="username" value="{$username|escape}"><br />
{if $username_error}<span class="nwaError">{$username_error|escape}</span><br />{/if}
{if $radius_weblogin.username_auth == 'username'}<div style="display:none;">{/if}
<font color="FFFFFF"><b><label for="password">Password:</label></b></font><br />
<input type="password" style="width: 200px;" id="password" name="password"><br />
{if $password_error}<span class="nwaError">{$password_error|escape}</span><br />{/if}
{if $radius_weblogin.username_auth}</div>{/if}

{if $radius_weblogin.login_terms_require}
Terms of use:
<input type="checkbox" id="ID_form895025d7_weblogin_visitor_accept_terms" name="visitor_accept_terms" value="1">
      <label id="LB_ID_form895025d7_weblogin_visitor_accept_terms" for="ID_form895025d7_weblogin_visitor_accept_terms">I accept the <a href="public/terms.html" target="_blank">terms of use</a>
{if $visitor_accept_terms_error}<span class="nwaError">{$visitor_accept_terms_error|escape}</span><br />{/if}
<input type="submit" style="width: 200px;" id="submit" name="submit" value="Log In" onclick="return usernameupdate();">

<!--The below JavaScript will ensure to stop adding the domain prefix if it is already exist or entered-->
<script type="text/javascript">
    function usernameupdate() {
          var domainname = document.getElementById("Domain").value;
        var username = document.getElementById("username").value;
        if(username.indexOf("\\") > -1)
          return true;
        var unameupdate = domainname + "\\" + username;
        document.getElementById("username").value = unameupdate;
        return true;


Go to ClearPass Guest >> Configuration >> (Pages) >> Web Logins >> Create a new web login Page or Modify the existing page as shown below.


rtaImage (4).png



The above code is the sample with two domain names (Domain1 and Domain2) in it. Please replace the "Domain1 and Domain2" with your domain names.
The below example is the reference to add more domain names, if required.

<font color="FFFFFF"><b><label for="Domain">Domain:</label></b></font><br />
<select id ="Domain">
<!-- You could extend the below options and include the number required domain-->
  <option value="domain1">Domain1</option>
  <option value="domain2">Domain2</option>
  <option value="domain3">Domain3</option>
  <option value="domain4">Domain4</option>


Please find below the sample output of the login page.


rtaImage (5).png


The below output will confirm the addition of domain prefix to the authentication username when the user clicks on login.


rtaImage (6).png



Sample access tracker output.


rtaImage (7).png



Use Case:
This solution will be helpful when the customer comes up with the requirement to use a single web-login page to authenticate the users belong to multiple domain. The domain prefix added to the username can be used to categorize the service as well.


rtaImage (8).png



Version history
Revision #:
1 of 1
Last update:
‎04-08-2015 10:13 AM
Updated by:
Labels (1)
Search Airheads
Showing results for 
Search instead for 
Did you mean: