0001-misc-move-password-token-info-into-a-context-diction.patch
wcs/qommon/ident/password.py | ||
---|---|---|
173 | 173 | |
174 | 174 |
elif self.token.type == 'account-confirmation': |
175 | 175 |
template.html_top(_('Account Creation Confirmed')) |
176 |
account = PasswordAccount.get(self.token.username)
|
|
176 |
account = PasswordAccount.get(self.token.context['username'])
|
|
177 | 177 |
account.awaiting_confirmation = False |
178 | 178 |
account.store() |
179 | 179 | |
... | ... | |
362 | 362 | |
363 | 363 |
token = tokens.Token(3 * 86400) |
364 | 364 |
token.type = 'password-change' |
365 |
token.username = username
|
|
365 |
token.context = {'username': username}
|
|
366 | 366 |
token.store() |
367 | 367 | |
368 | 368 |
data = { |
... | ... | |
444 | 444 |
new_password = form.get_widget('new_password').parse().get('cleartext') |
445 | 445 | |
446 | 446 |
if form.is_submitted() and not form.has_errors(): |
447 |
account = PasswordAccount.get(token.username)
|
|
447 |
account = PasswordAccount.get(token.context['username'])
|
|
448 | 448 |
account.hashing_algo = passwords_cfg.get('hashing_algo', 'django') |
449 | 449 |
account.set_password(new_password) |
450 | 450 |
account.store() |
... | ... | |
463 | 463 |
# generate a new password and send it by email |
464 | 464 |
new_password = make_password() |
465 | 465 |
try: |
466 |
account = PasswordAccount.get(token.username)
|
|
466 |
account = PasswordAccount.get(token.context['username'])
|
|
467 | 467 |
user = account.user |
468 | 468 |
except KeyError: |
469 | 469 |
user = None |
... | ... | |
660 | 660 | |
661 | 661 |
token = tokens.Token(3 * 86400) |
662 | 662 |
token.type = 'account-confirmation' |
663 |
token.username = account.id
|
|
663 |
token.context = {'username': account.id}
|
|
664 | 664 |
token.store() |
665 | 665 | |
666 | 666 |
req = get_request() |
... | ... | |
1436 | 1436 |
continue |
1437 | 1437 |
if token.type == 'account-confirmation' and now > token.expiration: |
1438 | 1438 |
try: |
1439 |
account = PasswordAccount.get(token.username)
|
|
1439 |
account = PasswordAccount.get(token.context['username'])
|
|
1440 | 1440 |
except KeyError: |
1441 | 1441 |
# no such account, unncessary to keep the token |
1442 | 1442 |
token.remove_self() |
wcs/qommon/tokens.py | ||
---|---|---|
26 | 26 | |
27 | 27 |
type = None |
28 | 28 |
expiration = None |
29 |
context = None |
|
29 | 30 | |
30 | 31 |
def __init__(self, expiration_delay=86400, size=16, chars=None): |
31 | 32 |
chars = chars or list(string.digits + string.ascii_letters) |
32 |
- |