comparison roundup/password.py @ 7183:2de72f75f2f8

Production PBKDF rounds back to 2M, test 1k; fix empty_form (python2)
author John Rouillard <rouilj@ieee.org>
date Sun, 26 Feb 2023 15:38:49 -0500
parents d787f7282ea3
children 8b2287d850c8
comparison
equal deleted inserted replaced
7182:0c6617db0b97 7183:2de72f75f2f8
191 else: 191 else:
192 raw_salt = random_.token_bytes(20) 192 raw_salt = random_.token_bytes(20)
193 salt = h64encode(raw_salt) 193 salt = h64encode(raw_salt)
194 if config: 194 if config:
195 rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS 195 rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
196
197 # if we are testing
198 if ("pytest" in sys.modules and
199 "PYTEST_CURRENT_TEST" in os.environ):
200 if ("PYTEST_USE_CONFIG" in os.environ):
201 rounds = config.PASSWORD_PBKDF2_DEFAULT_ROUNDS
202 else:
203 # Use 1000 rounds unless the test signals it
204 # wants the config numberby setting
205 # PYTEST_USE_CONFIG Using the production 2M
206 # round values makes testing increase from 12
207 # minutes to 1 hour in CI.
208 rounds = 1000
196 else: 209 else:
197 if ("pytest" in sys.modules and 210 if ("pytest" in sys.modules and
198 "PYTEST_CURRENT_TEST" in os.environ): 211 "PYTEST_CURRENT_TEST" in os.environ):
199 # Set rounds to 1000 if no config is passed and 212 # Set rounds to 1000 if no config is passed and
200 # we are running within a pytest test. Using 213 # we are running within a pytest test.
201 # actual 2M production values makes testing
202 # increase from 12 minutes to 1 hour in CI.
203 rounds = 1000 214 rounds = 1000
204 else: 215 else:
205 import logging 216 import logging
206 # Log and abort. Initialize rounds and log (which 217 # Log and abort. Initialize rounds and log (which
207 # will probably be ignored) with traceback in case 218 # will probably be ignored) with traceback in case

Roundup Issue Tracker: http://roundup-tracker.org/