问题标签 [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 投票
0 回答
72 浏览

php - 如何在ZF2中添加2个渴望形式

我对 PHP 中的 Zend Framework 和 OOP 概念真的很陌生,我需要通过对我正在开发的应用程序使用一个 ZFC-USER 模块来创建 2 个具有不同布局的单独日志记录表单,称为 Admin 和 User。

谁能帮我解决这个问题或指导我如何解决这个问题

0 投票
1 回答
1092 浏览

zend-framework2 - ZF2 - Overriding Configuration of Vendor Module ZFcUser

EDIT: I just found the solution on my own. As my ContentManagerController extends AbstractRestfulController it naturally has no index action implemented. So the 'action' field in the 'defaults' array has to be overridden by '' or null. Then the proper action depending on the HTTP request type will be invoked as expected. Where was my mind?

Here's the updated code. Change

to

--- Original Post ---

I'm trying to override the routes of a vendor module (ZFcUser) from within a custom module's (ContentManager) module.config.php. The ContentManagerController extends the original UserController. I don't want to touch the ZFcUser's module.config.php, as it could lead into troubles after a prospective update via composer. I want to strictly seperate any configurations made by me from the original vendor files. Simply overriding

to

works for now, but isn't what I want to achieve. So, I need to replace the controller entry as well

with

But that gives me a 404 error.

Seems as if both controllers are in conflict. When I comment out the 'defaults' array in the ZFcUser module.config.php my ContentManagerController is then invoked as expected. I also made sure that my module is registered after the ZFcUser. So overriding should work, afaik.

I did a lot of research already but can't figure out what's going on here. The strategies described here and there don't do the trick.

Thanks for your help!

0 投票
2 回答
3470 浏览

zend-framework - 找不到角色错误

我正在尝试使用 BjyAuthorize 设置 ZfcUser。尝试访问受保护的路由“/user”时出现以下错误。

我的数据库表是使用 bjyauthorize 存储库中提供的 schema.sql 创建的,其中包含以下代码:

有条目:

user_role

user_role_linker

我不得不修改我的 bjyauthorize.global.php 文件,因为“role_id_field”和“parent_role_field”值与提供的 sql 模式不匹配。它看起来像这样:

我的 application.config.php 看起来像这样:

其中“用户”模块是我的自定义 ZfcUser 实体。

任何想法问题出在哪里?我对 ZF2 和 zfc 还很陌生,所以感谢您的帮助!

编辑:我应该注意,当我没有登录时,我在尝试访问 /user 时正确地得到了 403,当我登录时我收到了这条消息。我在尝试访问任何路线时收到它(无效路线除外,我收到 404)

0 投票
2 回答
3214 浏览

zend-framework2 - 使用 BjyAuthorize 配置基于角色的路由不起作用

这是我的 bjyauthorize.global.php 内容

我有一个这样的数据库结构:

我已经根据这个问题修改了用户表的列。我已经修改了ZfcUser的映射器,用于 user_id 到 id。它工作正常,因为它没有显示任何错误。

即使没有任何错误,我在登录前访问的任何模块(/user 和 /collections)除了登录页面(zfcuser/login)外,总是得到“403 Forbidden”。

我对 user_role_linker 表的数据有疑问。我没有找到适当的文档来为BjyAuth 库中的 user_role 表输入角色数据。建议我在配置文件或数据库表中是否有任何错误配置或其他任何此处未提及的内容。

0 投票
1 回答
697 浏览

zend-framework2 - ZfcUser 注册后重定向到我选择的页面

在 zfcuser 注册后,我一直在尝试重定向到我选择的页面/路由。目前它重定向到登录页面。

我能够对我现在使用 recaptcha 而不是 figlet 的 init 事件进行更改。

我在 zfcuser 的注册事件上的模块的引导方法上添加了一个侦听器。但不确定之后要做什么,以便在用户注册后重定向到我选择的页面。任何帮助将不胜感激,因为它也会对我对 zf2 的基本理解有很大帮助。

这是我在 zfcuser 注册事件上的模块类上的引导代码(那里没什么):

0 投票
1 回答
561 浏览

phpunit - BjyAuthorize 和 PHPUnit

我开始使用 ZfcUser + BjyAuthorize 为 Zend Framework 2 项目进行单元测试。

我不是单元测试专家,所以我在这里找到了如何模拟 ZfcUser 。

现在我还必须模拟 BjyAuthorize。有没有人设法做到这一点?

0 投票
1 回答
1085 浏览

orm - 登录时 BjyAuthorize 未检测到角色

我正在使用 ZF2、Doctrine ORM 和 BjyAuthorize。

问题是,当我登录时,身份的 getRoles 方法返回空。

另一方面,如果我在控制器中获取实体并使用 getRoles,则可以毫无问题地获取值。

你能告诉我哪一个可能是问题吗?

这是我的 zfc-user-doctrine-orm-global:

0 投票
0 回答
1018 浏览

session - Zend2, Zfcuser - 自动注销

我正在使用 Zend Framework 2、ZfcUser 和 BjyAuthorize。登录和访问控制有效,但在某些情况下用户会被注销:当他们尝试导航到不同的页面时,当前页面上的 AJAX 调用仍在运行。

在 Chrome 的网络窗口中,它显示 AJAX 调用已取消,然后调用您尝试导航到的页面,以下代码检查您是否已登录,发现您未登录($auth->hasIdentity()返回 false),然后发送你到登录页面。

显然会话刚刚消失?我在弄清楚如何/在哪里保存它时遇到了一些麻烦。使用了 ZfcUser\Authentication\Storage\Db,但它使用 Storage\Session 作为存储,现在我不确定那是什么类。

有没有人遇到过类似的情况,或者有建议在哪里检查?

0 投票
1 回答
1038 浏览

zend-framework2 - 在 ZfcUser 模块中更改语言

我在 Zend 2 项目中使用ZfcUser。但我必须使用意大利语翻译而不是英文翻译。

我在翻译器属性中的项目模块/应用程序/config/module.config.php 中进行了更改,并且都以意大利语开头,而不是模块的一部分。

在目录 vendor/ZfcUser/src/ZfcUser/language 中有 it_IT.po 和 it_IT.mo 文件。

没变化。如何将我的应用程序的语言与模块链接起来?

MOD1:

我添加了翻译器,但似乎没有任何效果

添加代码:

提前致谢

0 投票
1 回答
1555 浏览

email - Zend -> ZfcUser 在电子邮件验证/激活后创建新用户

我正在使用 ZfcUser 模块在一个已经有工作注册表单的网站上工作。

但是,我还需要能够通过我创建的管理页面创建用户。一步一步是这样的:管理员通过填写名字、姓氏和电子邮件来添加用户。电子邮件被发送给用户。用户单击验证链接并被重定向到网站。现在用户只需要输入他想要的密码就可以了。

如果可能的话,我怎么能做到这一点?