会话不活动中的注销链接弹出 [英] Sign Out link in the session inactivity pop up

查看:84
本文介绍了会话不活动中的注销链接弹出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何在liferay中弹出的会话不活动中添加一个注销"链接? 目前,该弹出窗口中没有任何超链接.我们仅显示警告消息. 请帮助我解决该问题,因为我是liferay的新手.

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.

谢谢, 苏拉夫

推荐答案

这是解决问题的方法:您可以在Liferay中查找警告文本本身.您可以在翻译文件(portal-impl/src/content/Language * .properties)中找到它.一种方法是在此处添加所需的HTML(您可以轻松找到的键是warning-your-session-will-expire)

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)

如果您不愿意在其中添加它(翻译文件不是添加HTML标记的我最喜欢的地方),则必须在Liferay中的其他位置查找此键的出现.您可以在portal-web/docroot/html/js/liferay/session.js中找到它.第一次出现

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>';

(请注意,这消除了Liferay在其他上下文中运行的可能性,例如不在/上运行)

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

或者,只需搜索更多出现的instance._warningText,您就会找到它的使用位置,并且可以使用其他位置来更改消息的内容(提示:它位于同一文件中)

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)

尽管session.js是一个javascript文件,但实际上您可以构建一个jsp钩子并使用与覆盖jsp文件相同的技术来覆盖此文件.不过,您可能需要清除应用服务器中的临时文件,因为该文件可能已经缩小了&与其他JavaScript资源一起缓存.

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.

这篇关于会话不活动中的注销链接弹出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆