防止缓存登录信息

编程入门 行业动态 更新时间:2024-10-10 02:17:30
本文介绍了防止缓存登录信息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我正在使用 femanager 来管理用户注册,登录和注销.

I'am using femanager to manage user registration, login and logout.

与其他许多网站一样,我想在页面顶部显示一些用户信息(使用Boostraps mini-navbar ).

Like many other websites, I'd like to show some user information on the top of the page (using Boostraps mini-navbar).

  • 如果用户已注销,则应如下所示:
  • 如果用户已登录,则应显示以下信息:

作为Typo3的初学者,我使用Typo脚本和Fluid Template中的局部代码实现了这一点.Typo脚本读取当前用户(用户ID和电子邮件地址).

As a Typo3 beginner, I implement this with Typo Script and a partial in Fluid Template. The Typo Script reads the current user (user id and e-mail address).

userdata = COA_INT userdata { 10 = TEXT 10.data = TSFE:fe_user|user|uid 20 = TEXT 20.data = TSFE:fe_user|user|username }

Partial使用用户ID来检查用户是否已登录.

The partial uses the user id to check if the user is logged in or logged out.

<f:if condition="{f:cObject(typoscriptObjectPath: 'userdata.10')} > 0"> <f:then> <!-- user is logged in --> <span class="greeting"> <i class="fa fa-user"></i> <f:cObject typoscriptObjectPath="userdata.20" /> </span> <f:link.page pageUid="319" additionalParams="{logintype: 'logout'}" class="pull-right"><i class="fa fa-power-off"></i> Logout</f:link.page> </f:then> <f:else> <!-- user is logged out --> <span class="greeting"> Test it for free </span> <f:link.page pageUid="317" class="pull-right"><i class="fa fa-arrow-circle-down"></i> Register</f:link.page> <f:link.page pageUid="319" class="pull-right"><i class="fa fa fa-sign-in"></i> Log in</f:link.page> </f:else> </f:if>

这可以正常工作,但是我在缓存方面遇到了问题.有时,迷你导航栏会显示给另一个用户.

This works OK but I have problems with caching. Sometimes the mini-navbar is shown for an other user.

我的问题是:如何防止部分缓存?

推荐答案

部分"中的缓存有时会比较棘手..

Caching in Partials can be tricky sometimes..

看看VHS viewhelper集合中的安全性viewhelper.它具有一些不错的功能,可以满足您的情况:

Take a look at the security viewhelper within the VHS viewhelper collection. It has some nice functionality which covers your case:

<v:security.allow anyFrontendUser="TRUE"> <f:then><!-- protected information displayed --></f:then> <f:else><!-- link to login form displayed --></f:else> </v:security.allow>

有关详细信息,请参见文档.

See the documenation for more information.

更多推荐

防止缓存登录信息

本文发布于:2023-11-01 11:00:45,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1549157.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:缓存   信息

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!