问题标签 [zfcuser]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
3 回答
2490 浏览

module - zfcUser getState 在另一个模块中

我如何从 zfcUser 获取状态

在 view/index.phtml 我从 $this->zfcUserIdentity()->getState();

但现在我需要在其他模块/控制器(这是我的成本模块控制器)中获取这个值(这个用户的状态)

所以我需要从以下位置获取状态:zfcUser/Entity/User 到 myModule/Controller

我看这个https://github.com/ZF-Commons/ZfcUser/wiki/How-to-check-if-the-user-is-logged-in但这个解决方案没有帮助

0 投票
1 回答
1537 浏览

zend-framework2 - 如何在zend框架2中跨子域共享zfcuser

我在我的应用程序中安装了 zfcuser 模块,一切正常。我配置了主机名路由器,在这里我的问题开始了,当我登录主域(http://example.com)时一切正常,但是当我转到任何子域(http://test.example.com,http: //anysubdomain.example.com)我正在失去登录状态,并且在每个子域上我都必须再次登录。如何跨子域共享登录状态?在 ZF1 中我只是设置了 'cookie_domain' 并且它可以工作,但是如何在 ZF2 中实现呢?当然我也在使用 Bjyauthorize 并且我想在子域上保留 bjyauthorize 警卫......

0 投票
2 回答
3518 浏览

php - Zend Framework 2 - ZFCUser 模块安装

我的ZF2项目需要一个身份验证模块。

ZFCUser 似乎很好,我成功安装了它。但是现在由于缺少任何进一步的文档(或者我只是不知道在哪里寻找它),我有点迷失了。

1)我想包含ZFCUser-DoctrineORM但自述文件基本上说的是模块的名称,仅此而已。我该怎么做才能让它工作?

在尝试了一段时间后,我在 URL 下找到了登录页面/user/和一个代码片段,它显示了如何在另一个页面上包含表单。

2) 但是我如何让我的所有其他页面或模块都需要登录?

0 投票
5 回答
18354 浏览

php - Zend Framework 2 - Global check for authentication with ZFCUser

I installed ZFCUser successfully. Now I wonder if there is a way to globally check for authentication.

As outlined in the wiki there are several ways to check for auth. They all work but do I have to put the check-if-clause really in every single action? All my sites should be only accessable when beeing logged in and if not, you should be rerouted to the login page.

Does anybody know if there's a central place where I can put this logic?

0 投票
1 回答
2069 浏览

zend-framework2 - Zend Framework-2:保护所有控制器的最佳方法?(ZfcUser/HybridAuth)

我正在使用ZfcUserviaHybridAuth来启用 Facebook 身份验证Zend Framework 2。我下载了scn-social-auth模块并添加到我的项目中。现在,模块下的控制器user受到ZfcUser保护。也就是说,如果我没有登录,它会将我重定向到登录页面。

用户未登录:访问“ http://localhost/user ”=> 将重定向到:“ http://localhost/user/login

现在,我想用ZfcUser. 也就是说,我创建的任何模块,如果我的用户没有登录,它应该将我重定向到“ http://localhost/user/login ”。这样做最好的是什么?我可以检查用户是否登录了每个模块中的每个操作。但是,它看起来不是一个好的选择。有什么建议吗?

问候,
湿婆

0 投票
2 回答
2059 浏览

php - Zend Framework 2 - ZFCUser - 翻译登录表单

我正在使用ZFCUser并且需要开发一个德国项目。

不幸的是,登录表单是英文的,我找不到将表单字段特别是错误消息翻译成英文的方法。

模块是否有一种全局方式来覆盖消息或切换语言?

谢谢!

编辑:

这是我在引导程序中调用的翻译器:

编辑二:

我的自定义翻译文件:

我的工厂:

Module.php 来自我的用户模块:

编辑三:

我的翻译器看起来像这样。即使使用 PHP 文件而不是数组,也不会发生任何事情。没有错误,没有翻译。任何想法我做错了什么?

0 投票
2 回答
1494 浏览

zend-framework2 - ZFCUser extend form

I am using Zendframework 2 with ZfcUser and ZfcUserDoctrineORM. I extended the normal user with some additional information.

Now i want to adapt the registerForm. Therefor i created this form in the ZfcUser\Form folder:

In the Next step I changed adapted the getServiceConfig() function in the Module.php in the ZfcUser folder:

When calling the register url this error message is shown:

Fatal error: Cannot redeclare class UserRegister in C:\xampp\htdocs\THWDiver\vendor\zf-commons\zfc-user\src\ZfcUser\Form\UserRegister.php on line 24

What am I making wrong?

0 投票
1 回答
902 浏览

zend-framework2 - 扩展完整的 ZfcUser 模块

我想扩展 ZfcUser 模块,但我不想编辑原始 ZfcUser 文件。如何扩展 module.php、视图和表单文件等文件?或者甚至可以扩展整个模块?

0 投票
2 回答
5341 浏览

php - 使用 ZfcUser 的控制器的简单 ZF2 单元测试

我在尝试对使用 ZfcUser 进行身份验证的操作进行单元测试时遇到问题。我需要一些方法来模拟 ZfcUser 控制器插件,但我不太确定如何做到这一点。我已经成功地为表和模型生成了一些单元测试,但是控制器需要大量注入的对象并导致问题。有谁知道如何设置 ZfcUser 模拟以成功对控制器进行单元测试?

这是我的测试(从 ZF2 教程中复制):

我在 setUp 方法中尝试了以下操作:

但我不确定如何将它注入到控制器实例中。

假设我的索引操作代码如下:

测试结果:

导致此异常的行是控制器:如果(!$this->zfcUserAuthentication()->hasIdentity()) { 该行与 SmsController 中的第 974 行相关。

很明显我无权访问 ZfcUserAuthentication 服务,所以问题是,如何模拟 ZfcUserAuthentication 服务并将其注入到我的控制器中?

为了继续这个主题,我将如何模拟登录用户以成功测试我的操作是否符合规范?

0 投票
1 回答
782 浏览

php - 使用 zfcuser 和自定义模块选择字段

我上周开始学习ZF2。我已经成功安装了骨架应用程序和 ZfcUser 模块。我决定按照 ZfcUser Wiki 中的建议编辑注册表单: https ://github.com/ZF-Commons/ZfcUser/wiki/How-to-modify-the-form-objects-used-by-ZfcUser

并添加一个选择字段,您可以在官方表单文档中找到相同的字段。

但是选择没有正确显示,因为它像输入字段一样呈现。你可以 在这里看到一个例子。

这是我的 Application/Module.php

拜托,谁能帮助我理解这种行为并指出正确的方向?