User Accounts
# plone.app.users/browser/account-panel.pt <div class="autotabs" <nav class="autotoc-nav" tal:define="view_actions view/prepareObjectTabs;"
Batch-adding Users to Plone using CSV (Excel) files by Tom Lazar for Plone 2.5.x
collective.emailconfirmationregistration: to provide an extra verification step for Plone when self-registration is enabled
dexterity.membrane: Bcrypt passwords Case-Sensitive Email Address
- Create a textfile with your userdata. The format is:
password;userid;lastname;firstname;email
- Log into the ZMI of your site and create a 'File' instance at the root of your plone instance. Give it the id 'users.csv' and the file you just created:
- Download this script.
- Also at the site root, create a 'Script (Python') instance in the root folder of your plone instance with the id 'importPASfromCSV' and the script you just downloaded. Click the 'Add and Edit' button:
- In the following form click on the 'Test' tab:
This will execute the script and its output will be shown onscreen.
Batch Creating Users Create Accounts From Database
# Create new members with properties supplied from a CSV file. # The script expects a File object with id `users.csv` in the same folder # it resides. # # The format of the CSV needs to be: # # Firstname Lastname <email@address.com> # # created 2006-11-03 by Tom Lazar <tom@tomster.org>, http://tomster.org/ # under a BSD-style licence (i.e. use as you wish but don't sue me) from Products.CMFCore.utils import getToolByName users = context['users.csv'].data.split('\n') regtool = getToolByName(context, 'portal_registration') index = 1 imported_count = 0 for user in users: user = user.strip('>') tokens = user.split('<') if len(tokens) == 2: name, email = tokens properties = { 'username' : email, 'fullname' : name, 'email' : email.strip(), } try: passwd = regtool.generatePassword() regtool.addMember(email, passwd, properties=properties) print "Successfully added %s (%s) with email %s" % (name, email, email) imported_count += 1 except ValueError, e: print "Couldn't add %s: %s" % (email, e) else: print "Could not parse line %d because it had the following contents: '%s'" % (index, user) index += 1 print "Imported %d users (from %d lines of CSV)" % (imported_count, index) return printed
Import Users From ZSQL Query Import/Export Users Using bin/instance debug UW Oshkosh
Sending Email
Send Email Group Email: collective.contentrules/mailtogroup formlib vs z3c.form
ftw.usermanagement Login / Logout Audit Log: collective.fingerpointing eventlog with mailinglogger
collective.portlet.mybookmarks
Forcing Password Change is not easy
plone/app/users/configure.zcml
<browser:page name="member-registration" for="Products.CMFPlone.interfaces.IPloneSiteRoot" class=".registration.RegistrationControlPanel" permission="cmf.ManagePortal" />
plone/app/users/browser/configure.zcml
<browser:page name="register" for="plone.app.layout.navigation.interfaces.INavigationRoot" class=".register.RegistrationForm" permission="cmf.AddPortalMember" />
<browser:page name="new-user" for="plone.app.layout.navigation.interfaces.INavigationRoot" class=".register.AddUserForm" permission="zope2.ManageUsers" />
plone/app/users/browser/register.py
class RegistrationForm(BaseRegistrationForm): """ Dynamically get fields from user data, through admin config settings. """ label = _(u'heading_registration_form', default=u'Registration form') description = u"" template = ViewPageTemplateFile('register_form.pt') @property def showForm(self): """The form should not be displayed to the user if the system is incapable of sending emails and email validation is switched on (users are not allowed to select their own passwords). """ ctrlOverview = getMultiAdapter((self.context, self.request), name='overview-controlpanel') portal = getUtility(ISiteRoot) # hide form iff mailhost_warning == True and validate_email == True return not (ctrlOverview.mailhost_warning() and portal.getProperty('validate_email', True)) @property def form_fields(self): if not self.showForm: # We do not want to spend time calculating fields that # will never get displayed. return [] portal = getUtility(ISiteRoot) defaultFields = super(RegistrationForm, self).form_fields # Can the user actually set his/her own password? if portal.getProperty('validate_email', True): # No? Remove the password fields. defaultFields = defaultFields.omit('password', 'password_ctl') # Show a message indicating that a password reset link # will be mailed to the user. defaultFields['mail_me'].custom_widget = CantChoosePasswordWidget else: # The portal is not interested in validating emails, and # the user is not interested in getting an email with a # link to set his password if he can set this password in # the current form already. defaultFields = defaultFields.omit('mail_me') return defaultFields
@@user-information?userid=USERID
Products.MailHost/MailHost.py does not lstrip any longer
Password Reset Link Invalid: plone.app.upgrade
collective.examples.userdata
Plone4 之前要搭配 0.4 版本,新版使用 z3c.form 來擴充表單欄位,昇級情況下,要留意是否使用到 IUserDataSchemaProvider 並事先移除這個 Utility。利用 setMemberProperty 偵錯,可用 Override 方式更換 EditForm。
Membership Active Only After Review 審核後會員才生效
collective.customizablePersonalizeForm: adding extra fields, you can specify your own getters & setters if you don’t want your field to be manage as a user property. You’ll also be able to add comptabile widgets for the personal preferences’ form fields.