Skip to content. | Skip to navigation

Personal tools


You are here: Home / Tips / User Accounts

User Accounts

<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

  1. Create a textfile with your userdata. The format is:
  2. 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:
    Adding the CSV-file
  3. Download this script.
  4. 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:
    Adding the Python script
  5. In the following form click on the 'Test' tab:
    Execute the script
    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 <>
# created 2006-11-03 by Tom Lazar <>,
# 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(),
            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)
        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

Huge Amount of Users

Add Team Field

Change User ID

Display Who Is Online

Sending Email

Send Email Group Email: collective.contentrules/mailtogroup formlib vs z3c.form

Form Mail Sender Expression

ftw.usermanagement Login / Logout Audit Log: collective.fingerpointing eventlog with mailinglogger

Spam User Management


Forcing Password Change is not easy






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('')

    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))

    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
            # 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



Products.MailHost/ does not lstrip any longer

Password Reset Link Invalid:


Plone4 之前要搭配 0.4 版本,新版使用 z3c.form 來擴充表單欄位,昇級情況下,要留意是否使用到 IUserDataSchemaProvider 並事先移除這個 Utility利用 setMemberProperty 偵錯可用 Override 方式更換 EditForm

Membership Active Only After Review 審核後會員才生效

User Form for Multiple Site

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.

瀏覽器的記住密碼 autocomplete