Magento 永久客户会议
前提很简单。
新客户到达我们的网站,被重定向到注册/登录页面(因为他们是新访客,并且不存在 cookie),并且在注册或登录后(如果已经有帐户但从不同的计算机/浏览器访问),他们被带到主页。
每次他们随后访问时,他们不应该看到注册/登录页面(除非他们明确注销,cookie 被禁用/阻止,或者他们从不同的浏览器/设备访问)。
我认为从理论上讲,将 cookie 值设置为一个荒谬的高数字(在我们的例子中,30 年以上)并在重定向到注册/登录页面之前检查该 cookie 是否存在是可行的。
在我们的例子中,情况并非如此。我觉得会话仍然持续大约一个小时左右,然后返回网站主页将用户重定向到注册/登录。
那么我在这里缺少什么?有什么建议吗?
- -编辑 - - 我们的网络主机向我保证 session.gc_maxlifetime 不是问题。我在我们的开发服务器上将其设置为 86400,在让浏览器闲置一夜后,我第二天返回,我认为它按预期工作。
我遇到的一个问题是,它还将 magento 管理超时设置为相同的值,如果员工被授予 Magento 管理访问权限,然后被解雇/退出等,这可能会带来安全风险。我当然不希望他们的会话继续下去,只要我们希望客户会话持续(几个月)。
我希望 CONFIG>>ADVANCED>>ADMIN>>SECURITY>>SESSION LIFETIME 设置不会被此覆盖。
The premise is simple.
New customer arrives at our site, is redirected to the register/login page (since they are a new visitor and no cookie is present) and after registering or logging in (if already have an account but visiting from a different machine/browser) they are taken to the home page.
Every time they subsequently visit, they should not see the register/login page (unless they explicitly log out, cookies are disabled/blocked, or they visit from a different browser/device).
I would think that theoretically, setting the cookie value to an absurdly high number (in our case, 30+ years) and checking for the presence of that cookie before the redirect to the register/login page would work.
In our case it is not. I feel like the session is still lasting roughly an hour or so before a visit back to the home page of the site redirects a user to register/login.
So what am I missing here? Any advice?
---edit---
I had been assured by our web host that session.gc_maxlifetime was not the issue. I set it to 86400 on our development server and after leaving my browser idle overnight, I returned the next day and I think it's working as intended.
One issue I have with this is that it also sets the magento admin timeout to the same value, which may introduce a security risk if an employee is given Magento admin access and then gets fired/quits/etc. I certainly don't want their session to continue for as long as we want customer sessions to last (months).
I'm hoping that the CONFIG>>ADVANCED>>ADMIN>>SECURITY>>SESSION LIFETIME setting is not overridden by this.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您的问题很可能与 Php 会话值有关,您需要增加它以匹配 cookie 持续时间中的值;在您的 php.ini 上输入以下内容:
您需要将“86400”值替换为您希望会话/cookie 持续的等效时间 我建议您将会话和 cookie 值“604800”设置为大约一周。
您的服务器上将发生的情况是,magento 将在 var/sessions 文件夹下为每个会话创建一个会话文件。这可能会导致您的服务器耗尽 inode,具体取决于您的服务器配置。
干杯!
Your problem is most likely with the Php session value you need to increase it to match the value in the cookie duration; on your php.ini put the following:
You need to replace the '86400' value with what equivalent time that you want the session / cookie to last I would advice that you set your sessions and cookie value'604800' that's about a week.
What is going to happen on your server is that magento is going to a session file per session under the var/sessions folder. This can potentially can cause your server to run out of inodes , depends on your server configuration.
Cheers!