Sign Out link in the session inactivity pop up

前端 未结 1 437
死守一世寂寞
死守一世寂寞 2021-01-23 05:03

How can i add one Sign Out link in the session inactivity pop up in liferay? Currently we don\'t have any hyperlink in that pop-up .We are having only the warning messages. Plea

1条回答
  •  被撕碎了的回忆
    2021-01-23 05:52

    Here's the way to solve it: You can look up the warning text itself in Liferay. You'll find it in the translation files (portal-impl/src/content/Language*.properties. One method is to add the HTML required just there (the key, as you'll easily find, is warning-your-session-will-expire)

    If you're not comfortable adding it there (Translation files are not my favourite place to add HTML markup) you'll have to find occurrences of this key elsewhere in Liferay. You'll find it in portal-web/docroot/html/js/liferay/session.js. The first occurrence there says

     instance._warningText = Liferay.Language.get('warning-your-session-will-expire');
    

    You can easily customize the text here, e.g. with

     instance._warningText = 
        Liferay.Language.get('warning-your-session-will-expire') + 
        ' ' + 
        Liferay.Language.get('sign-out') +
        '';
    

    (note that this is omitting the possibility that Liferay is running in a different context, e.g. not on /)

    Alternatively, just search for more occurrences of instance._warningText and you'll find where it's used and can use other places to change the content of the message (hint: it's in the same file)

    Despite session.js being a javascript file, you can actually build a jsp hook and override this file with the same technique as you'd override a jsp file. You might need to clean out temporary files in your appserver though, as this file might have been minified & cached with other javascript resources.

    0 讨论(0)
提交回复
热议问题