I want to get the IP address of the connecting source using UI Script

Kurea
Mega Guru

Hello everyone.

 

I want to get the IP address of the connecting source using UI Script.

 

Specifically, I want to add a script to the UI script "sn_ex_sp.ec_url_whitelist" that is launched when the ESC login screen (/esc) is accessed, and implement logic to obtain the IP address of the connection source.

 

However, it seems that "session.getClientIP();" cannot be used in UI script, so I don't know how to get the IP address.

 

"session.getClientIP();" works fine in a script include, so it would be nice if I could call a specific script include from a UI script, but I don't know how to implement that.

 

Can anyone please help? Any information would be appreciated.

 

Thank you.

1 ACCEPTED SOLUTION

Kurea
Mega Guru

I found a solution.

 

The function I wanted to implement this time was the "IP address acquisition logic" that runs when the ESC login screen is accessed.

To achieve this, I had to customize the "Login" widget placed on the ESC login screen, rather than using a UI script.

 

◆Steps

  1. Duplicate the "Login" widget.
  2. Add the following script to the server script.
    var ipad = gs.getSession().getClientIP()
  3. For each portal login page, replace the configured widget with the widget created in step 1.

View solution in original post

1 REPLY 1

Kurea
Mega Guru

I found a solution.

 

The function I wanted to implement this time was the "IP address acquisition logic" that runs when the ESC login screen is accessed.

To achieve this, I had to customize the "Login" widget placed on the ESC login screen, rather than using a UI script.

 

◆Steps

  1. Duplicate the "Login" widget.
  2. Add the following script to the server script.
    var ipad = gs.getSession().getClientIP()
  3. For each portal login page, replace the configured widget with the widget created in step 1.