Adding Text, Links and Other Elements to the NetScaler Logon Page - Part 2

Part 2: Learn How to Customize the New NetScaler Receiver for Web UI (RfWebUI) Theme

As we discussed in Part 1 of this post, there are three categories of NetScaler customizations:

1) Customizations that do not require any rewrite policies/actions (“policies”) or source code modifications (“modifications”),

2) Customizations that can be accomplished using either policies or modification, and

3) Customizations that will most probably need modification of the source code.

In Part 1, we focused on the Default, Green Bubble, and X1 (the "original") themes. In part 2, we will discuss the newest theme - Receiver for Web UI (RfWebUI), which uses a completely new mechanism.

While the logon page of the theme  looks like the X1 theme:

RfWebUI 1.jpg

... don't let it fool you. If you will be using this theme, you can forget pretty much everything you've learned about customizing the NetScaler logon page.  

Let's begin with the location of the logon page. When using the original themes, the logon page (index.html) is served from the  /netscaler/ns_gui/vpn/ directory. With the RfWebUI theme, the file is served from /var/netscaler/logon/LogonPoint/. The good news is that since the page is now in the /var partition, any modifications to the page (or copies of the logon page) are automatically persisted across a reboot. No longer do you need to add lines to rc.netscaler to copy modified files into the flash partition.

The next major change is how you modify text. The portal wizard allows you to easily make changes to commonly updated text. Let's say you wanted to change the labels on the logon screen. After clicking OK at the bottom of the wizard, you will then be prompted for the language you wish to use:

Theme Language.jpg

After clicking OK, you will see the pages you can modify on the right-hand side of the page.   

 Theme Pages.jpg

Click Login Page. You are presented with the default labels for the page:

Default logon page labels.jpg

Let's modify them as follows:

Modified logon page labels.jpg

Click Ok.

Modified logon page labels 2.jpg

Finally, click Done. Now, let's refresh the page (you may need to clear your cache).

Logon screen with modified labels.jpg 

If you've had experience customizing the original NetScaler themes, at this point you are probably thinking "Tell me something that I don't already know ... this is no different than modifying any of the other themes"! Not quite ... The portal wizard functions differently depending on which theme has been chosen. For the original themes, the portal wizard would modify the values in the <language code>.xml file in the resources directory (e.g. /var/netscaler/logon/themes/<theme>/resources/en.xml). The keys affected are located under the Partition ID of Logon. Now, what if you wished to modify the text of the logon button above, which you can't do from the portal wizard? No problem. In the same file, as few lines down, we find:

<Property id="Log_On" property="value">Log On</Property>

Simply change it to:

<Property id="Log_On" property="value">Click to log on</Property>

... and then save the file.

Try that with a theme based on RfWebUI and you will find that it doesn't work. In fact, if you look at the <language code>.xml file in the resources directory of a RfWebUI-based theme, you will notice that the portal wizard did *not* modify ANY of the keys in that file. What gives??

For RfWebUI-based themes, those text changes are written to /var/netscaler/logon/themes/<theme>/strings.<language code>.json:

strings.en.json.jpg

While the portal wizard writes all the values on a single line. I would suggest placing each override on a separate line for readability and maintainability. Also note that this "key":"value" format differs from the XML format of the other themes. 

In order to change other text elements on the page, you will need to get the key to be placed in the override file. The keys may be found in the file /var/netscaler/logon/LogonPoint/receiver/js/localization/<language code>/ctxs.strings.js. The key for the logon button is nsg_LogOnbutton. Let's add an override for it to the above file:

strings.en.json 2.jpg

Then save the file, and refresh the page. In addition to clearing the cache on your PC, it may take 2-3 minutes for the cache to be cleared on the NetScaler.

RfWebUI 2.jpg

Now, let's try to add our own custom text fields as we did with the X1 theme in part 1.

Here we come to another major difference. In the original themes, we would:

- Add a <div> with a unique id (either via a rewrite action/policy or a modified gateway_login_form_view.js file),

- Add a string with the <div>'s id to the XML file in the resources directory, and finally 

- Add a CSS selector with the <div>'s id to the custom.css file in the selected theme.

Note that everything is keyed off the id of the <div>.

With RfWebUI-based themes, text is keyed off of class names, and the class name must begin with _ctxstxt_. So, to add the "authorized users only" warning (see Part 1), we make a copy of the index.html file (let's call it custom.html), and add our custom <div>:

auth users only.jpg

We then add an entry with the text into strings.en.json (without the _ctxstxt_ prefix):

auth users only 2.jpg 

We also need to add style information, but instead of adding it to custom.css, for RfWebUI-based themes, it must go into theme.css. Here you can either use the <div>'s id (if specified), or the full class name (including the _ctxstxt_ prefix).

auth users css 1.jpg

We can test by browsing to our custom.html file.

Logon screen with auth users only.jpg

Let's not forget our footer ... add another custom <div>:

footer.jpg

Then add the text:

auth users only 3.jpg

... and then the CSS:

auth users css 2.jpg

Browsing to our custom page:

Logon screen with footer.jpg 

Our final step is to create a responder policy and bind it to our AG vServer. This will automatically invoke our custom page when we browse to the AG vServer FQDN:

> add responder action "Logon Page Redirect Action" redirect "\"custom.html\"" -responseStatusCode 302
> add responder policy "Logon Page Redirect Policy" "HTTP.REQ.URL.PATH_AND_QUERY.CONTAINS(\"LogonPoint/index.html\")" "Logon Page Redirect Action"
> bind vpn vserver "AG vServer" -policy "Logon Page Redirect Policy" -priority 100 -gotoPriorityExpression END -type REQUEST
> save config

To remove the customizations, simply unbind the responder policy.

Important: Make sure to keep backup copies of all files. Re-running the portal wizard will wipe out any manual updates that you have made to the files.

Here is a handy cheat-sheet summarizing all of the above:

RfWebUI Cheat Sheet.jpg 

 

Thanks to the NetScaler development team for their assistance, especially Bidyut H.

Sam Jacobs is the Director of Technology Development at IPM, the longest standing Citrix Platinum Partner on the East Coast. With more than 25 years of IT consulting, Sam is a NetScaler customizations and integrations industry expert. He holds Microsoft MCSD, Citrix CCP-M and CCP-N certifications, and is the editor of TechDevCorner.com, a technical resource blog for IT professionals. He is one of the top Citrix support Forum contributors, and has earned industry praise for the tools he has developed to make NetScaler, StoreFront and Web Interface easier to manage for administrators and more intuitive for end users. Sam became a Citrix Technology Professional (CTP) in 2015. Sam can be reached at: sam.jacobs@ipm.com or on Twitter at: @WIGuru.

12 Comments
3 Likes

Issues with Portal Themes

May 24, 2017 02:24 PM by Michael Goodman

Sam,

 Thanks for the great article.  I'm finding that the detect receiver screen and log off screen are not being branded with the theme.  I've tried both X1 and Rfwebui themes on NetScaler 11.1 and 12. Have you seen this before?  Thanks

Re; Issues with Portal Themes

May 24, 2017 07:01 PM by Sam Jacobs

Are you not seeing any customization at all, or only some of it is working ?

Please respond directly to me (sjacobs@ipm.com), as the system doesn't send me an email when there's a comment. I'm also at Synergy, so responses may be delayed.

Hyperlink

January 25, 2018 10:27 AM by Stuart Thompson

Hi Sam,

Great article!

Do you know how I can add a hyperlink into either the text below logon prompt or the footer?

I'm using the RFwebUI theme and I can get it to display basic text fine but not a hyperlink. Have tried adding a <h ref into the strings.en.json file but I'm guessing it's not supported as won't show up.

Thanks,

Stuart

Re: Hyperlink

January 25, 2018 11:37 AM by Sam Jacobs

Hi Stuart,

 

Try HTML-encoding the brackets ... use &lt; for < and &gt; for >.

(Make sure to include the semi-colon).

 

Sam

Upgrading

February 1, 2018 02:29 PM by Ray Davis

How does this affect when upgrading from 11.1 to higher versions?

Re: Upgrading

February 1, 2018 05:57 PM by Sam Jacobs

Hi Ray,

The answer is that it depends on Citrix.
Before themes were introduced, one needed to modify the actual HTML code, which pretty much changes from one version to another. Copying an older, customized version of a file over the new code base usually rendered the site inoperable.
There's a tremendous advantage to using themes. Besides the fact that you can now use different themes for different vServers, with themes, you don't modify the actual code. You're adding "overrides" to the CSS and Javascript that renders the page. One does that by targeting CSS "selectors," identified either by a div ID, or a class name. So as long as Citrix keeps the same div IDs and class names from one version to the next, the upgrade should be relatively painless. However, there is no guarantee that they will actually do so.

Sam

Links in text

February 19, 2018 05:19 AM by Ronald Stoop

Hi Sam, 

Great articles, part 1 en 2.. I have used them to put a text below the log on button. It displays the text.. but not the links. I used the HTML codes like you mentioned. 

Try HTML-encoding the brackets ... use &lt; for < and &gt; for >.

(Make sure to include the semi-colon).

But it just displays it as text (<a href... etc)? 

Do you have any tips for me?  

 

Re: Links in text

February 20, 2018 06:49 AM by Ronald Stoop

Hi Sam, 

I solved it myself. We use firmware NS12.0 53.13.nc. I use a custom X1 theme together with n-factor authentication on a gateway. In thje strings.en.json I can use <a href=></a> without using the codes you mentioned. The cause of my problem was that there were invalid characters in the string which would result in loading a default strings file and no message would be displayed. 

Change text in EULA

May 23, 2018 09:45 AM by Stuart Thompson

Hi Sam,

I am having trouble making changes to the EULA text on my NetScaler gatway logon page. Am using the RFwebUI theme on NetScaler 12. I'd like to change the header text on the pop-up box that that appears when you click on 'Terms & conditions'. I'd like to change it from 'End User Licence Agreement' to something else.

I have tried changing the text in the following two files but doesn;t seem to have made any difference:

/var/netscaler/logon/themes/Theme_Name/resources/en.xml
/var/netscaler/logon/LogonPoint/receiver/js/localization/en/ctxs.strings.js

Do you know which files I need to edit to change this text?

Thanks,
Stuart

Re: Change text in EULA

May 23, 2018 11:17 AM by Sam Jacobs

Hi Stuart,

The changes would go in:

/var/netscaler/logon/themes/<themeName>/strings.en.json (not .js).

For example:

{"End_User_License_Agreement":"You agree to the following"}

Regards,

Sam

Re: Change text in EULA

May 23, 2018 11:23 AM by Sam Jacobs

The NetScaler caches content, so it may take a bit of time for the change to show up. Also, make sure to clear your browser cache.

Sam

 

Thanks!

June 5, 2018 09:23 AM by Stuart Thompson

Adding that line to the strings.en.json file worked perfectly. Thanks for your help!

Please login to add your comments.

Recent Stories
Workspace Environment Manager – Capture Screen

Some Tips for National Cyber Security Awareness Month

My Favourite Overlooked vs. Hidden Citrix Workspace App Features