0001-context_processors-adapt-user_urls-for-authentic-623.patch
hobo/context_processors.py | ||
---|---|---|
214 | 214 |
context['registration_url'] = ( |
215 | 215 |
template_vars['idp_registration_url'] + '?' + urlencode({'next': absolute_uri}) |
216 | 216 |
) |
217 |
if 'authentic2' in settings.INSTALLED_APPS: |
|
218 |
if request.path == '/login/': |
|
219 |
context['login_url'] = '#' |
|
220 |
context['registration_url'] = '/register/?' + request.GET.urlencode() |
|
221 |
if request.path == '/register/': |
|
222 |
context['login_url'] = '/login/?' + request.GET.urlencode() |
|
223 |
context['registration_url'] = '#' |
|
217 | 224 |
return context |
tests/test_context_processors.py | ||
---|---|---|
81 | 81 |
'registration_url': 'https://idp/register/?next=http%3A%2F%2Ftestserver%2Fpage%2F', |
82 | 82 |
'account_url': 'https://idp/accounts/?next=http%3A%2F%2Ftestserver%2Fpage%2F', |
83 | 83 |
} |
84 | ||
85 |
from django.conf import settings as real_settings |
|
86 | ||
87 |
real_settings.INSTALLED_APPS += ('authentic2',) |
|
88 |
request = rf.get('/login/?next=coin&nonce=2') |
|
89 |
assert user_urls(request) == { |
|
90 |
'login_url': '#', |
|
91 |
'logout_url': '/logout/?next=%2F', |
|
92 |
'registration_url': '/register/?next=coin&nonce=2', |
|
93 |
'account_url': 'https://idp/accounts/?next=http%3A%2F%2Ftestserver%2Flogin%2F%3Fnext%3Dcoin%26nonce%3D2', |
|
94 |
} |
|
95 | ||
96 |
request = rf.get('/register/?next=coin&nonce=2') |
|
97 |
assert user_urls(request) == { |
|
98 |
'login_url': '/login/?next=coin&nonce=2', |
|
99 |
'logout_url': '/logout/?next=%2F', |
|
100 |
'registration_url': '#', |
|
101 |
'account_url': 'https://idp/accounts/?next=http%3A%2F%2Ftestserver%2Fregister%2F%3Fnext%3Dcoin%26nonce%3D2', |
|
102 |
} |
|
84 |
- |