GuR*_*uRu 1 login prestashop prestashop-1.6
我使用最新prestashop 1.6.1.4,我希望每个客户首先登录网站,然后他们可以访问网页的所有页面,没有登录用户不能在网站上做任何事情.
所以,我想知道backoffice旁边有任何配置,如果是,那么怎么办呢?
没有内置函数可以执行此操作,但您可以轻松覆盖FrontController以实现此行为.
将此代码放入/override/classes/controller/FrontController.php:
<?php
class FrontController extends FrontControllerCore
{
public function init()
{
parent::init();
if (!$this->context->customer->isLogged() && $this->php_self != 'authentication' && $this->php_self != 'password')
{
Tools::redirect('index.php?controller=authentication?back=index');
}
}
}
Run Code Online (Sandbox Code Playgroud)
如果用户不在身份验证页面或忘记密码页面,则会将其重定向到身份验证页面.登录后,他将被重定向到家中.
编辑:
如果该文件FrontController.php不存在,则必须创建该文件并删除该文件/cache/class_index.php.class_index缓存您网站上的每个课程路径.因此,如果您创建一个新的类文件,则需要删除它以让Prestashop搜索新创建的类文件.
| 归档时间: |
|
| 查看次数: |
957 次 |
| 最近记录: |