Plone登录系统
项目描述
构建状态
plone.login
基于portal_skins的登录的现代化替换品。
安装
通过将其添加到您的buildout安装ploneconf.site
[buildout] ... eggs = plone.login
然后运行bin/buildout。在/prefs_install_products_form中按常规安装它
兼容性
plone.login经过测试,可在Plone 5.1上正常工作。它应该也可以与Plone 5.0一起工作,但尚未进行测试。
自定义模板
任何plone.login的模板都可以自定义,因为它们是简单的浏览器视图。使用z3c.jbot来应用您的自定义覆盖。
自定义登录后重定向的位置
您可以根据需要自定义用户在成功登录网站后将被重定向到的位置。
只需编写如下适配器
from plone.login.interfaces import IRedirectAfterLogin
from plone.login.interfaces import IInitialLogin
from Products.CMFPlone.utils import safe_unicode
from zope.interface import implementer
from plone import api
@implementer(IRedirectAfterLogin)
class RedirectAfterLoginAdapter(object):
def __init__(self, context, request):
self.context = context
self.request = request
def __call__(self, came_from=None, is_initial_login=False):
if 'Reviewer' in api.user.get_roles():
api.portal.show_message(
u'Get to work!', self.request)
came_from = self.context.portal_url() + '/@@full_review_list'
else:
user = api.user.get_current()
fullname = safe_unicode(user.getProperty('fullname'))
api.portal.show_message(
u'Nice to see you again, {0}!'.format(fullname), self.request)
if not came_from:
came_from = self.context.portal_url()
return came_from
然后通过ZCML注册适配器
<adapter factory="your.addon.adapters.RedirectAfterLoginAdapter" for="OFS.interfaces.ITraversable zope.publisher.interfaces.IRequest" />
如您所见,此适配器适配上下文和请求,因此请根据您的需求进行修改。
Plone基金会,作者
变更日志
1.0rc1 (2018-06-18)
使用templer创建的包 [The Plone Foundation]
项目详情
关闭
plone.login-1.0rc1.tar.gz的哈希值
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 16128d57ed435dfad74a75a95219c09684a7267414eaac45bb6688c6594f851d |
|
MD5 | 2a98e27666e3fef494afc8b6ce3d5a6c |
|
BLAKE2b-256 | 0b03e63482f9fb08dbecac2fb438fd0449a177f0ccfdb17f865a18d2d86e26ef |