Did I find the right examples for you? yes no      Crawl my project      Python Jobs

All Samples(36)  |  Call(27)  |  Derive(0)  |  Import(9)
Encrypt the provided plain text password using the encoding if provided
and return it in an LDAP-style representation.

        def pw_encrypt(pw, encoding='SSHA'):
    """Encrypt the provided plain text password using the encoding if provided
    and return it in an LDAP-style representation."""
    for id, prefix, scheme in _schemes:
        if encoding == id:
            return prefix + scheme.encrypt(pw)
    raise ValueError('Not supported: %s' % encoding)
        


src/d/e/dexterity.membrane-0.4/dexterity/membrane/behavior/membraneuser.py   dexterity.membrane(Download)
import logging
 
from AccessControl.AuthEncoding import pw_encrypt
from AccessControl.AuthEncoding import pw_validate
from Products.CMFCore.utils import getToolByName
    def _set_password(self, password):
        # When editing, the password field is empty in the browser; do
        # not do anything then.
        if password is not None:
            self.context.password = pw_encrypt(password)

src/c/o/collective.salesforce.fundraising-HEAD/collective/salesforce/fundraising/forms.py   collective.salesforce.fundraising(Download)
from zope.component.hooks import getSite
 
from AccessControl.AuthEncoding import pw_encrypt
from AccessControl.SecurityManagement import newSecurityManager
 
        res = get_brains_for_email(self.context, data['email'], self.request)
        person = res[0].getObject()
        person.password = pw_encrypt(data['password'])
        person.registered = True
 
            'email': data['email'],
            'email_opt_in': data['email_opt_in'],
            'password': pw_encrypt(data['password']),
            'registered': True,
        }

src/e/r/erp5-HEAD/bt5/erp5_registry_ohada/DocumentTemplateItem/PsjPerson.py   erp5(Download)
 
from AccessControl import ClassSecurityInfo
from AccessControl.AuthEncoding import pw_encrypt, pw_validate
from Products.CMFCore.utils import getToolByName
from Products.ERP5Type import Permissions, PropertySheet

src/a/c/AccessControl-3.0.8/src/AccessControl/tests/testPasswordDigest.py   AccessControl(Download)
    def testGoodPassword(self):
        pw = 'good_password'
        assert len(AuthEncoding.listSchemes()) > 0  # At least one must exist!
        for id in AuthEncoding.listSchemes():
            enc = AuthEncoding.pw_encrypt(pw, id)
    def testBadPasword(self):
        pw = 'OK_pa55w0rd \n'
        for id in AuthEncoding.listSchemes():
            enc = AuthEncoding.pw_encrypt(pw, id)
            assert enc != pw
    def testShortPassword(self):
        pw = '1'
        for id in AuthEncoding.listSchemes():
            enc = AuthEncoding.pw_encrypt(pw, id)
            assert enc != pw
    def testLongPassword(self):
        pw = 'Pw' * 2000
        for id in AuthEncoding.listSchemes():
            enc = AuthEncoding.pw_encrypt(pw, id)
            assert enc != pw
    def testBlankPassword(self):
        pw = ''
        for id in AuthEncoding.listSchemes():
            enc = AuthEncoding.pw_encrypt(pw, id)
            assert enc != pw

src/p/r/Products.PluggableAuthService-1.10.0/Products/PluggableAuthService/plugins/tests/test_ZODBUserManager.py   Products.PluggableAuthService(Download)
import unittest
 
from AccessControl.AuthEncoding import pw_encrypt
from zExceptions import Forbidden
 
    def test_addUser_with_preencrypted_password(self):
        # See collector #1869 && #1926
        from AccessControl.AuthEncoding import pw_encrypt
 
        USER_ID = 'already_encrypted'
        PASSWORD = 'password'
 
        ENCRYPTED = pw_encrypt(PASSWORD)
    def test_updateUserPassword_with_preencrypted_password(self):
        USER_ID = 'already_encrypted'
        PASSWORD = 'password'
 
        ENCRYPTED = pw_encrypt(PASSWORD)
    def test_manage_updateUserPassword_POST_permissions(self):
        USER_ID = 'testuser'
        PASSWORD = 'password'
        ENCRYPTED = pw_encrypt(PASSWORD)
 

src/p/r/Products.PluggableAuthService-1.10.0/Products/PluggableAuthService/tests/test_UserFolder.py   Products.PluggableAuthService(Download)
    def test__doAddUser_with_preencrypted_passwords(self):
        # See collector #1869 && #1926
        from AccessControl.AuthEncoding import pw_encrypt
 
        USER_ID = 'already_encrypted'
        PASSWORD = 'password'
 
        ENCRYPTED = pw_encrypt(PASSWORD)

Previous  1 | 2