work in progress: self registration with email notiification/confirmation
This commit is contained in:
parent
cad21c5dc3
commit
feb6ea1a06
3 changed files with 45 additions and 6 deletions
|
@ -27,6 +27,18 @@
|
||||||
class="loops.organize.browser.member.MemberRegistration"
|
class="loops.organize.browser.member.MemberRegistration"
|
||||||
permission="zope.View" />
|
permission="zope.View" />
|
||||||
|
|
||||||
|
<browser:page
|
||||||
|
for="loops.interfaces.INode"
|
||||||
|
name="selfservice_registration.html"
|
||||||
|
class="loops.organize.browser.member.SecureMemberRegistration"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
|
<browser:page
|
||||||
|
for="loops.interfaces.INode"
|
||||||
|
name="selfservice_confirmation.html"
|
||||||
|
class="loops.organize.browser.member.ConfirmMemberRegistration"
|
||||||
|
permission="zope.View" />
|
||||||
|
|
||||||
<browser:page
|
<browser:page
|
||||||
for="loops.interfaces.INode"
|
for="loops.interfaces.INode"
|
||||||
name="change_password.html"
|
name="change_password.html"
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
#
|
#
|
||||||
# Copyright (c) 2008 Helmut Merz helmutm@cy55.de
|
# Copyright (c) 2013 Helmut Merz helmutm@cy55.de
|
||||||
#
|
#
|
||||||
# This program is free software; you can redistribute it and/or modify
|
# This program is free software; you can redistribute it and/or modify
|
||||||
# it under the terms of the GNU General Public License as published by
|
# it under the terms of the GNU General Public License as published by
|
||||||
|
@ -19,8 +19,6 @@
|
||||||
"""
|
"""
|
||||||
Definition of view classes and other browser related stuff for
|
Definition of view classes and other browser related stuff for
|
||||||
members (persons).
|
members (persons).
|
||||||
|
|
||||||
$Id$
|
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from zope import interface, component
|
from zope import interface, component
|
||||||
|
@ -78,7 +76,7 @@ class PersonalInfo(ConceptView):
|
||||||
|
|
||||||
class MemberRegistration(NodeView, CreateForm):
|
class MemberRegistration(NodeView, CreateForm):
|
||||||
|
|
||||||
interface = IMemberRegistration
|
interface = IMemberRegistration # TODO: add company, create institution
|
||||||
message = _(u'The user account has been created.')
|
message = _(u'The user account has been created.')
|
||||||
|
|
||||||
formErrors = dict(
|
formErrors = dict(
|
||||||
|
@ -99,7 +97,7 @@ class MemberRegistration(NodeView, CreateForm):
|
||||||
|
|
||||||
def checkPermissions(self):
|
def checkPermissions(self):
|
||||||
personType = adapted(self.conceptManager['person'])
|
personType = adapted(self.conceptManager['person'])
|
||||||
perms = IOptions(personType)('registration.permission')
|
perms = IOptions(personType)(self.permissions_key)
|
||||||
if perms:
|
if perms:
|
||||||
return checkPermission(perms[0], self.context)
|
return checkPermission(perms[0], self.context)
|
||||||
return checkPermission('loops.ManageSite', self.context)
|
return checkPermission('loops.ManageSite', self.context)
|
||||||
|
@ -114,7 +112,7 @@ class MemberRegistration(NodeView, CreateForm):
|
||||||
schema.fields.remove('birthDate')
|
schema.fields.remove('birthDate')
|
||||||
schema.fields.reorder(-2, 'loginName')
|
schema.fields.reorder(-2, 'loginName')
|
||||||
return schema
|
return schema
|
||||||
|
# TODO: add company, create institution
|
||||||
@Lazy
|
@Lazy
|
||||||
def object(self):
|
def object(self):
|
||||||
return Person(Concept())
|
return Person(Concept())
|
||||||
|
@ -157,6 +155,31 @@ class MemberRegistration(NodeView, CreateForm):
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
||||||
|
class SecureMemberRegistration(MemberRegistration):
|
||||||
|
|
||||||
|
permissions_key = u'secure_registration.permissions'
|
||||||
|
roles_key = u'secure_registration.roles'
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def schema(self):
|
||||||
|
schema = super(MemberRegistration, self).schema
|
||||||
|
schema.fields.remove('birthDate')
|
||||||
|
schema.fields.remove('password')
|
||||||
|
schema.fields.remove('passwordConfirm')
|
||||||
|
schema.fields.remove('phoneNumbers')
|
||||||
|
schema.fields.reorder(-2, 'loginName')
|
||||||
|
return schema
|
||||||
|
|
||||||
|
|
||||||
|
class ConfirmMemberRegistration(NodeView):
|
||||||
|
|
||||||
|
# TODO: control form via interface?
|
||||||
|
|
||||||
|
@Lazy
|
||||||
|
def macro(self):
|
||||||
|
return organize_macros.macros['confirm']
|
||||||
|
|
||||||
|
|
||||||
class PasswordChange(NodeView, Form):
|
class PasswordChange(NodeView, Form):
|
||||||
|
|
||||||
interface = IPasswordChange
|
interface = IPasswordChange
|
||||||
|
|
|
@ -1,5 +1,9 @@
|
||||||
<html i18n:domain="loops">
|
<html i18n:domain="loops">
|
||||||
|
|
||||||
|
<metal:registration define-macro="confirm">
|
||||||
|
</metal:registration>
|
||||||
|
|
||||||
|
|
||||||
<metal:task define-macro="task">
|
<metal:task define-macro="task">
|
||||||
<metal:data use-macro="view/concept_macros/conceptdata">
|
<metal:data use-macro="view/concept_macros/conceptdata">
|
||||||
</metal:data>
|
</metal:data>
|
||||||
|
|
Loading…
Add table
Reference in a new issue