Mercurial > p > roundup > code
comparison roundup/admin.py @ 7203:12a3cd86668f
auto update 'password_pbkdf2_default_rounds' "
If the current value for password_pbkdf2_default_rounds is the old
default value of 10000, updateconfig will use the new default
value when writing the new config.
If the curreny value for password_pbkdf2_default_rounds is less than
the new default the user will be told to update the value.
New translation strings added. Updates to upgrading.txt doc.
| author | John Rouillard <rouilj@ieee.org> |
|---|---|
| date | Wed, 01 Mar 2023 10:51:37 -0500 |
| parents | 0c6617db0b97 |
| children | ccb0e566e0be |
comparison
equal
deleted
inserted
replaced
| 7202:b222658a3504 | 7203:12a3cd86668f |
|---|---|
| 564 Generate a new tracker config file (ini style) with default | 564 Generate a new tracker config file (ini style) with default |
| 565 values in <filename>. | 565 values in <filename>. |
| 566 """ | 566 """ |
| 567 if len(args) < 1: | 567 if len(args) < 1: |
| 568 raise UsageError(_('Not enough arguments supplied')) | 568 raise UsageError(_('Not enough arguments supplied')) |
| 569 | |
| 569 if update: | 570 if update: |
| 570 # load current config for writing | 571 # load current config for writing |
| 571 config = CoreConfig(self.tracker_home) | 572 config = CoreConfig(self.tracker_home) |
| 573 | |
| 574 # change config to update settings to new defaults | |
| 575 # where prior defaults were chosen | |
| 576 default_ppdr = config._get_option( | |
| 577 'PASSWORD_PBKDF2_DEFAULT_ROUNDS')._default_value | |
| 578 | |
| 579 print("") # put a blank line before feedback | |
| 580 if config.PASSWORD_PBKDF2_DEFAULT_ROUNDS in [10000]: | |
| 581 print(_("Changing option\n" | |
| 582 " 'password_pbkdf2_default_rounds'\n" | |
| 583 "from old default of %(old_number)s to new " | |
| 584 "default of %(new_number)s.") % { | |
| 585 "old_number": | |
| 586 config.PASSWORD_PBKDF2_DEFAULT_ROUNDS, | |
| 587 "new_number": default_ppdr | |
| 588 } | |
| 589 ) | |
| 590 config.PASSWORD_PBKDF2_DEFAULT_ROUNDS = default_ppdr | |
| 591 | |
| 592 if config.PASSWORD_PBKDF2_DEFAULT_ROUNDS < default_ppdr: | |
| 593 print(_("Update " | |
| 594 "'password_pbkdf2_default_rounds'" | |
| 595 "to a number equal to or larger\nthan %s.") % | |
| 596 default_ppdr) | |
| 572 else: | 597 else: |
| 573 # generate default config | 598 # generate default config |
| 574 config = CoreConfig() | 599 config = CoreConfig() |
| 600 | |
| 575 config.save(args[0]) | 601 config.save(args[0]) |
| 576 | 602 |
| 577 def do_updateconfig(self, args): | 603 def do_updateconfig(self, args): |
| 578 ''"""Usage: updateconfig <filename> | 604 ''"""Usage: updateconfig <filename> |
| 579 Generate an updated tracker config file (ini style) in | 605 Generate an updated tracker config file (ini style) in |
