Capture login in portal customization

Hi,

In freshdesk portal customization, I would like to run a functionality when the user logs in.
What I expect is how can we trigger a function when a user logs into the support portal everytime.

Thanks in advance

1 Like

hello i use this script to load freshchat with user data when he logs in! See if it helps you!

 indent preformatted text by 4 spaces
  {% if portal.has_user_signed_in %}
           <script src="https://wchat.freshchat.com/js/widget.js"></script>
              <script>
                  window.fcWidget.init({
                   token: "TOKEN",
                   host: "https://wchat.freshchat.com",
                   firstName: "{{portal.user.name}}",
                   email: "{{portal.user.email}}",
                   phone: "{{portal.user.mobile}}"
                 });
              </script>
{% endif %}
1 Like

Hi Marllon,
Thank you for your effort. I hope your code works always once the portal is loggedin. I want to display a popup when the user logs in for the first time. Popup can be closed. Next time the popup has to be shown only after the user logs out and logs in again.

With this you can validate if the user is logged in, to control the popup display I believe it would be possible to control through a cookie!
{% if portal.has_user_signed_in%}

{% else%}

{% endif%}

Yes exactly that’s what I’m trying. Thank u for your support.