如何在 Zotonic 验证器的管理界面中引用配置值?

发布于 2024-09-26 04:39:41 字数 337 浏览 0 评论 0原文

我希望能够引用模板中 Zotonic 管理界面中设置的系统配置值。

特别是,我想创建一个可配置的密码复杂性正则表达式,以便我可以编写一个验证语句,如下所示:

{% validate id="new_password" type={format pattern=config.mod_admin_identity.password_regex %}

How do yourefer to Config value from the admin interface in Zotonic validators?

I would like to be able to refer to a System Configuration value set in the Zotonic admin interface within a template.

In particular I would like to create a configurable password complexity regex so I can write a validate statement like the following:

{% validate id="new_password" type={format pattern=config.mod_admin_identity.password_regex %}

How do you refer to Config values from the admin interface in Zotonic validators?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

亣腦蒛氧 2024-10-03 04:39:41

由于 Arjan 的新搜索,我很快就能找到答案 http://zotonic.com/search?q =confighttp://zotonic.com/documentation/719/m-config< /a> 并使用 m_config 快速设计了一个解决方案。

以下是对 _action_dialog_set_username_password.tpl 的修改,它基于模块 mod_admin_identity 的管理配置提供密码复杂性强制执行,其中密钥 password_regex 自动降级为一个简单的存在检查:

{% if m.config.mod_admin_identity.password_regex.value %}
    {% validate id="new_password" type={presence} type={format pattern=m.config.mod_admin_identity.password_regex.value} %}
{% else %}
    {% validate id="new_password" type={presence} %}
{% endif %}

The answer is quick to retrieve thanks to Arjan's new search I went from http://zotonic.com/search?q=config to http://zotonic.com/documentation/719/m-config and quickly devised a solution using m_config.

Here is a modification to _action_dialog_set_username_password.tpl that provides password complexity enforcement based on an admin config for module mod_admin_identity with key password_regex that auto-degrades to a simple presence check:

{% if m.config.mod_admin_identity.password_regex.value %}
    {% validate id="new_password" type={presence} type={format pattern=m.config.mod_admin_identity.password_regex.value} %}
{% else %}
    {% validate id="new_password" type={presence} %}
{% endif %}
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文