Commit 8618ac16 authored by BAIRE Anthony's avatar BAIRE Anthony

add a ALLGO_ALLOW_LOCAL_ACCOUNTS var to allow using local accounts

this is for development purpose because:
- setting-up gitlab auth is tedious
- developer needs access to multiple accounts
parent adee89f5
......@@ -6,6 +6,7 @@ import config.env
GLOBAL_CONTEXT = types.MappingProxyType({
"ALLGO_ALLOW_LOCAL_ACCOUNTS": parse_bool(config.env.ALLGO_ALLOW_LOCAL_ACCOUNTS)
})
def global_context(request):
......
......@@ -21,15 +21,21 @@
<ul class="navbar-nav ml-auto">
{% if not user.is_authenticated %}
<li class="nav-item">
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
{% for account in socialaccount_providers %}
<a href="{% provider_login_url account.id %}"
class="btn btn-primary {{ account.id }} text-center ">Log in with Gitlab</a>
{% endfor %}
{% if ALLGO_ALLOW_LOCAL_ACCOUNTS %}
<li class="nav-item {% is_active request 'account_login' %}">
<a class="nav-link" href="{% url 'account_login' %}">Sign in</a>
</li>
{% else %}
<li class="nav-item">
{% get_providers as socialaccount_providers %}
{% if socialaccount_providers %}
{% for account in socialaccount_providers %}
<a href="{% provider_login_url account.id %}"
class="btn btn-primary {{ account.id }} text-center ">Log in with Gitlab</a>
{% endfor %}
{% endif %}
</li>
{% endif %}
</li>
{% else %}
<li class="nav-item {% is_active request 'user_webapp_list' 'webapp_update' 'webapp_creation' 'webapp_sandbox_panel' %}">
<a class="nav-link" href="{% url 'main:user_webapp_list' user.get_username %}"><i class="fas fa-cloud"></i> Apps</a>
......
......@@ -184,6 +184,11 @@ with env_loader.EnvironmentVarLoader(__name__, "ALLGO_",
env_var("ALLGO_WEBAPP_DEFAULT_MEMORY_LIMIT_MB", default=str(4*1024),
help="default memory limit (in megabytes) for newly created webapps")
env_var("ALLGO_ALLOW_LOCAL_ACCOUNTS", protected=True, default="False",
help="""Allow signing in with a local account (for development
purpose only)""")
#
# allgo authentication tokens
#
......
......@@ -39,6 +39,7 @@ services:
ALLGO_ALLOWED_IP_ADMIN: "0.0.0.0/0"
ALLGO_DATASTORE: "/vol/rw/datastore"
ALLGO_DEBUG: "True"
ALLGO_ALLOW_LOCAL_ACCOUNTS: "True"
ALLGO_JUPYTER_URL: "http://0.0.0.0:8000/hub/login"
ALLGO_HTTP_SERVER: "django"
ALLGO_EMAIL_BACKEND: "django.core.mail.backends.console.EmailBackend"
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment