gpt4 book ai didi

plone - Plone 用户注册表中的验证码字段

转载 作者:行者123 更新时间:2023-12-04 02:17:35 25 4
gpt4 key购买 nike

我需要 plone 默认用户注册表单中的验证码字段 (@@register)。

最佳答案

使用 https://plone.org/products/quintagroup.formlib.captcha 解决

from mypackage import myMessageFactory as _
from quintagroup.formlib.captcha import Captcha
from quintagroup.formlib.captcha import CaptchaWidget
from plone.app.users.browser.register import RegistrationForm
from zope.interface import Interface
from zope.formlib import form


class ICaptchaSchema(Interface):
captcha = Captcha(
title=_(u'Prevent spam'),
description=_(
u'Type the text in the picture.'
),
)


class CustomRegistrationForm(RegistrationForm):
""" Custom registration form
"""

@property
def form_fields(self):
fields = super(CustomRegistrationForm, self).form_fields
fields += form.Fields(ICaptchaSchema)
fields['captcha'].custom_widget = CaptchaWidget

return fields

关于plone - Plone 用户注册表中的验证码字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33011737/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com