~barry/mailman/events-and-web

« back to all changes in this revision

Viewing changes to src/mailman/rest/users.py

  • Committer: Barry Warsaw
  • Date: 2012-06-28 03:03:04 UTC
  • mto: This revision was merged to the branch mainline in revision 7156.
  • Revision ID: barry@list.org-20120628030304-cjlh7q9tgwasxno2
Replace flufl.password with passlib, albeit with a wrapper.

Show diffs side-by-side

added added

removed removed

Lines of Context:
26
26
    ]
27
27
 
28
28
 
29
 
from flufl.password import lookup, make_secret, generate
 
29
from passlib.utils import generate_password as generate
30
30
from restish import http, resource
31
31
from uuid import UUID
32
32
from zope.component import getUtility
38
38
from mailman.rest.helpers import CollectionMixin, etag, no_content, path_to
39
39
from mailman.rest.preferences import Preferences
40
40
from mailman.rest.validator import Validator
 
41
from mailman.utilities.passwords import encrypt
41
42
 
42
43
 
43
44
 
102
103
        if password is None:
103
104
            # This will have to be reset since it cannot be retrieved.
104
105
            password = generate(int(config.passwords.password_length))
105
 
        scheme = lookup(config.passwords.password_scheme.upper())
106
 
        user.password = make_secret(password, scheme)
 
106
        user.password = encrypt(password)
107
107
        location = path_to('users/{0}'.format(user.user_id.int))
108
108
        return http.created(location, [], None)
109
109