Sign Out link in the session inactivity pop up

蹲街弑〆低调 提交于 2019-12-02 03:43:55

问题


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. Please help me how to solve this as i'm new to liferay.

Thanks, Sourav


回答1:


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') + 
    ' <a href="/c/portal/logout">' + 
    Liferay.Language.get('sign-out') +
    '</a>';

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



来源:https://stackoverflow.com/questions/16701659/sign-out-link-in-the-session-inactivity-pop-up

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!