mirror of https://github.com/zulip/zulip.git
auth: Deduplicate config error blocks for different auths.
Extend the context dictionary with variables `social_backend_name` and `backend_error` flag which determines if the error should be shown. Not extended this for ldap, smtp and saml as they have a different format of block.
This commit is contained in:
parent
1308544a70
commit
7a9a5263cd
|
@ -48,47 +48,20 @@
|
|||
{{ render_markdown_path('zerver/dev-not-supported-error.md', {"settings_path": settings_path}) }}
|
||||
{% endif %}
|
||||
|
||||
{% if google_error %}
|
||||
{% if backend_error %}
|
||||
{% if development_environment %}
|
||||
{{ render_markdown_path('zerver/google-error.md', {"root_domain_uri": root_domain_uri, "settings_path": secrets_path, "secrets_path": secrets_path, "client_id_key_name": "social_auth_google_key"}) }}
|
||||
{{ render_markdown_path('zerver/'+social_backend_name+'-error.md',
|
||||
{"root_domain_uri": root_domain_uri, "settings_path": secrets_path, "secrets_path": secrets_path,
|
||||
"client_id_key_name": "social_auth_" + social_backend_name + "_key"}) }}
|
||||
<p>
|
||||
For more information, have a look at
|
||||
the <a href="https://zulip.readthedocs.io/en/latest/development/authentication.html#google">authentication
|
||||
the <a href="https://zulip.readthedocs.io/en/latest/development/authentication.html#{{ social_backend_name }}">authentication
|
||||
setup guide</a> for the development environment.
|
||||
</p>
|
||||
{% else %}
|
||||
{{ render_markdown_path('zerver/google-error.md', {"root_domain_uri": root_domain_uri, "settings_path": settings_path, "secrets_path": secrets_path, "client_id_key_name": "SOCIAL_AUTH_GOOGLE_KEY"}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if github_error %}
|
||||
{% if development_environment %}
|
||||
{{ render_markdown_path('zerver/github-error.md', {"root_domain_uri": root_domain_uri, "settings_path": secrets_path, "secrets_path": secrets_path, "client_id_key_name": "social_auth_github_key"}) }}
|
||||
<p>
|
||||
For more information, have a look at
|
||||
the <a href="https://zulip.readthedocs.io/en/latest/development/authentication.html#github">authentication
|
||||
setup guide</a> for the development environment.
|
||||
</p>
|
||||
{% else %}
|
||||
{{ render_markdown_path('zerver/github-error.md', {"root_domain_uri": root_domain_uri, "settings_path": settings_path, "secrets_path": secrets_path, "client_id_key_name": "SOCIAL_AUTH_GITHUB_KEY"}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if gitlab_error %}
|
||||
{% if development_environment %}
|
||||
{{ render_markdown_path('zerver/gitlab-error.md', {"root_domain_uri": root_domain_uri, "settings_path": secrets_path, "secrets_path": secrets_path, "client_id_key_name": "social_auth_gitlab_key"}) }}
|
||||
<p>
|
||||
For more information, have a look at
|
||||
the <a href="https://zulip.readthedocs.io/en/latest/development/authentication.html#gitlab">authentication
|
||||
setup guide</a> for the development environment.
|
||||
</p>
|
||||
{% else %}
|
||||
{{ render_markdown_path('zerver/gitlab-error.md', {"root_domain_uri": root_domain_uri, "settings_path": settings_path, "secrets_path": secrets_path, "client_id_key_name": "SOCIAL_AUTH_GITLAB_KEY"}) }}
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if google_error or github_error or gitlab_error %}
|
||||
{% if not development_environment %}
|
||||
{{ render_markdown_path('zerver/'+social_backend_name+'-error.md',
|
||||
{"root_domain_uri": root_domain_uri, "settings_path": settings_path, "secrets_path": secrets_path,
|
||||
"client_id_key_name": "SOCIAL_AUTH_" + social_backend_name.upper() + "_KEY"}) }}
|
||||
<p>
|
||||
For more information, have a look at
|
||||
our <a href="https://zulip.readthedocs.io/en/latest/production/authentication-methods.html">authentication
|
||||
|
|
|
@ -567,13 +567,13 @@ i18n_urls = [
|
|||
|
||||
url(r'^config-error/google$', TemplateView.as_view(
|
||||
template_name='zerver/config_error.html',),
|
||||
{'google_error': True},),
|
||||
{'backend_error': True, 'social_backend_name': 'google'},),
|
||||
url(r'^config-error/github$', TemplateView.as_view(
|
||||
template_name='zerver/config_error.html',),
|
||||
{'github_error': True},),
|
||||
{'backend_error': True, 'social_backend_name': 'github'},),
|
||||
url(r'^config-error/gitlab$', TemplateView.as_view(
|
||||
template_name='zerver/config_error.html',),
|
||||
{'gitlab_error': True},),
|
||||
{'backend_error': True, 'social_backend_name': 'gitlab'},),
|
||||
url(r'^config-error/smtp$', TemplateView.as_view(
|
||||
template_name='zerver/config_error.html',),
|
||||
{'smtp_error': True},),
|
||||
|
|
Loading…
Reference in New Issue