comparison test/test_cgi.py @ 4486:693c75d56ebe

Add new config-option 'password_pbkdf2_default_rounds'... ...in 'main' section to configure the default parameter for new password generation. Set this to a higher value on faster systems which want more security. Thanks to Eli Collins for implementing this (see issue2550688). This now passes a config object (default None in which case we fall back to hard-coded parameters) into the password generation routine. This way we can add further parameters for password generation in the future. Also added a small regression test for this new feature.
author Ralf Schlatterbeck <schlatterbeck@users.sourceforge.net>
date Fri, 15 Apr 2011 08:09:59 +0000
parents 95aace124a8e
children abd2db0a159a
comparison
equal deleted inserted replaced
4485:95aace124a8e 4486:693c75d56ebe
446 self.assertEqual(scheme, pw1.scheme) 446 self.assertEqual(scheme, pw1.scheme)
447 actions.LoginAction(cl).handle() 447 actions.LoginAction(cl).handle()
448 pw = self.db.user.get(chef, 'password') 448 pw = self.db.user.get(chef, 'password')
449 self.assertEqual(pw, 'foo') 449 self.assertEqual(pw, 'foo')
450 self.assertEqual(pw, pw1) 450 self.assertEqual(pw, pw1)
451
452 def testPasswordConfigOption(self):
453 chef = self.db.user.lookup('Chef')
454 form = dict(__login_name='Chef', __login_password='foo')
455 cl = self._make_client(form)
456 self.db.config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = 1000
457 pw1 = password.Password('foo', scheme='crypt')
458 self.assertEqual(pw1.needs_migration(), True)
459 self.db.user.set(chef, password=pw1)
460 self.db.commit()
461 actions.LoginAction(cl).handle()
462 pw = self.db.user.get(chef, 'password')
463 self.assertEqual('PBKDF2', pw.scheme)
464 self.assertEqual(1000, password.pbkdf2_unpack(pw.password)[0])
451 465
452 # 466 #
453 # Boolean 467 # Boolean
454 # 468 #
455 def testEmptyBoolean(self): 469 def testEmptyBoolean(self):

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