Jump to content
Welcome to our new Citrix community!
  • Adding Text, Links and Other Elements to the NetScaler Logon Page - Part 2


    cugcblogs

    samjacobsrnd.png by Sam Jacobs, CTP

    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 DefaultGreen 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:

    jacobs12151601.jpeg.81038c43ea7024b686240234e58f9c05.jpeg

    ... 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:

    jacobs12151602.jpeg.5eb591eac4e6103ff5ada983cfbc878f.jpeg

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

    jacobs12151603.jpeg.dc271e76dac17c7bef1bcbd596e6a790.jpeg

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

    jacobs12151604.jpeg.0a46f106a806b7fa19c3283042b42fe3.jpeg

    Let's modify them as follows:

    jacobs12151605.jpeg.ea3d316bb9476885bca86345208f704a.jpeg

    Click Ok.

    jacobs12151606.jpeg.f729c6c02b2fc77aee3e010669f07366.jpeg

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

    jacobs12151607.jpeg.9ff13bc470c72d42117610fb7d89f6dc.jpeg

    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 .xml file in the resources directory (e.g. /var/netscaler/logon/themes//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:

     

    Log On

    Simply change it to:

    Click to log on

    ... 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 .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..json:

    jacobs12151608.jpeg.a0ed0d1c09d19c47514d40e32dbf515b.jpeg

    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//ctxs.strings.js. The key for the logon button is nsg_LogOnbutton. Let's add an override for it to the above file:

    jacobs12151609.jpeg.668803f31d22059c15f3930b286ca777.jpeg

    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.

    jacobs12151610.jpeg.679e65a0ef47031555657d2134413ea9.jpeg

    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

     with a unique id (either via a rewrite action/policy or a modified gateway_login_form_view.js file),

    - Add a string with the

    's id to the XML file in the resources directory, and finally 

    - Add a CSS selector with the

    's id to the custom.css file in the selected theme.

    Note that everything is keyed off the id of the

    .

    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 

    :

    jacobs12151611.jpeg.2a66e23b943c90b381952a095e309f3a.jpeg

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

    jacobs12151612.jpeg.e8336e38b088a48ad3fbf276fab4de8b.jpeg

    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 

    's id (if specified), or the full class name (including the _ctxstxt_ prefix).

    jacobs12151613.jpeg.c5d125403dabb89278293f2ccc35496c.jpeg

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

    jacobs12151614.jpeg.b2ae46c70f19bda1490d048b15a461af.jpeg

    Let's not forget our footer ... add another custom 

    :

    jacobs12151615.jpeg.d61ba1855a1280c73097d88ea5716949.jpeg

    Then add the text:

    jacobs12151616.jpeg.6a95a069029004f81f13b9a13a4e5613.jpeg

    ... and then the CSS:

    jacobs12151617.jpeg.58948cba69cd20b7e959ae1e8d92afbd.jpeg

    Browsing to our custom page:

    jacobs12151618.jpeg.4dfbd53d077a6540a59b7af048d85b55.jpeg

    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.

    #Blog

    #2021Top10Blogs

    #NetScaler


    User Feedback

    Recommended Comments

    Guest Top 10 Most-Read Blogs in 2021 – BLOGS

    Posted

    […] Adding Text, Links and Other Elements to the NetScaler Logon Page: Part 2 by Sam […]
    Link to comment
    Share on other sites



    Create an account or sign in to comment

    You need to be a member in order to leave a comment

    Create an account

    Sign up for a new account in our community. It's easy!

    Register a new account

    Sign in

    Already have an account? Sign in here.

    Sign In Now

×
×
  • Create New...