0001-multitenant-add-portal-slug-in-idp_registration_url-.patch
hobo/multitenant/settings_loaders.py | ||
---|---|---|
141 | 141 |
if 'portal-user' in service.get('template_name', ''): |
142 | 142 |
variables['portal_user_url'] = service.get('base_url') |
143 | 143 |
variables['portal_user_title'] = service.get('title') |
144 |
variables['portal_user_slug'] = service.get('slug') |
|
144 | 145 | |
145 | 146 |
if service.get('service-id') == 'authentic': |
146 | 147 |
variables['idp_url'] = service.get('base_url') |
... | ... | |
157 | 158 |
if 'portal-agent' in service.get('template_name', ''): |
158 | 159 |
variables['is_portal_agent'] = True |
159 | 160 | |
160 |
if 'portal_user_url' in variables and 'idp_registration_url' in variables: |
|
161 |
variables['idp_registration_url'] += '?%s' % urlencode({'next': variables['portal_user_url']}) |
|
161 |
if 'idp_registration_url' in variables: |
|
162 |
params = {} |
|
163 |
if 'portal_user_url' in variables: |
|
164 |
params['next'] = variables['portal_user_url'] |
|
165 |
if 'portal_user_slug' in variables: |
|
166 |
params['service'] = variables['portal_user_slug'] |
|
167 |
if params: |
|
168 |
variables['idp_registration_url'] += '?%s' % urlencode(params) |
|
162 | 169 | |
163 | 170 |
if getattr(settings, 'HOBO_MANAGER_HOMEPAGE_TITLE_VAR', None): |
164 | 171 |
variables['manager_homepage_title'] = \ |
tests/test_settings_loaders.py | ||
---|---|---|
143 | 143 |
loader.update_settings_from_path(tenant_settings, path) |
144 | 144 |
assert tenant_settings.SMS_URL == 'https://example.com/send/' |
145 | 145 |
assert tenant_settings.SMS_SENDER == 'Sender' |
146 | ||
147 | ||
148 |
def test_get_hobo_json_variables(tmpdir): |
|
149 |
a = Authentic(title='bar', slug='bar', base_url='http://bar.example.net') |
|
150 |
a.save() |
|
151 |
c = Combo(title='combo', slug='portal', base_url='http://portal.example.net', template_name='portal-user') |
|
152 |
c.save() |
|
153 | ||
154 |
loader = TemplateVars() |
|
155 |
env = get_hobo_json() |
|
156 | ||
157 |
variables = loader.get_hobo_json_variables(env) |
|
158 | ||
159 |
assert variables['idp_registration_url'] == 'http://bar.example.net/accounts/register/?next=http%3A%2F%2Fportal.example.net%2F&service=portal' |
|
146 |
- |