2056: Passlib r=mergify[bot] a=ghostwheel42

## What type of PR?

minor bug-fix

## What does this PR do?

compiles list of schemes using an iterator. will not fail when `scrypt` is not present in registry.

### Related issue(s)

updates #1753

## Prerequisites
Before we can consider review and merge, please make sure the following list is done and checked.
If an entry in not applicable, you can check it or remove it from the list.

- [ ] In case of feature or enhancement: documentation updated accordingly
- [ ] Unless it's docs or a minor change: add [changelog](https://mailu.io/master/contributors/workflow.html#changelog) entry file.


Co-authored-by: Alexander Graf <ghostwheel42@users.noreply.github.com>
master
bors[bot] 3 years ago committed by GitHub
commit 6a5ab161f4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -551,13 +551,13 @@ class User(Base, Email):
if cls._ctx: if cls._ctx:
return cls._ctx return cls._ctx
schemes = passlib.registry.list_crypt_handlers() # compile schemes
# scrypt throws a warning if the native wheels aren't found # - skip scrypt (throws a warning if the native wheels aren't found)
schemes.remove('scrypt') # - skip plaintext schemes (will be misidentified)
# we can't leave plaintext schemes as they will be misidentified schemes = [
for scheme in schemes: scheme for scheme in passlib.registry.list_crypt_handlers()
if scheme.endswith('plaintext'): if not (scheme == 'scrypt' or scheme.endswith('plaintext'))
schemes.remove(scheme) ]
cls._ctx = passlib.context.CryptContext( cls._ctx = passlib.context.CryptContext(
schemes=schemes, schemes=schemes,
default='bcrypt_sha256', default='bcrypt_sha256',

Loading…
Cancel
Save