Attention une mise à jour du service Gitlab va être effectuée le mardi 30 novembre entre 17h30 et 18h00. Cette mise à jour va générer une interruption du service dont nous ne maîtrisons pas complètement la durée mais qui ne devrait pas excéder quelques minutes. Cette mise à jour intermédiaire en version 14.0.12 nous permettra de rapidement pouvoir mettre à votre disposition une version plus récente.

Commit 8f01d79f authored by BERJON Matthieu's avatar BERJON Matthieu
Browse files

Merge branch '126-email-address-not-validated-when-the-user-changes-it' into 'django'

Resolve "email address not validated when the user changes it"

Closes #126

See merge request !134
parents 1a8a5cc2 5b36771d
Pipeline #43253 failed with stage
in 59 seconds
This diff is collapsed.
import types
from config.settings import parse_bool
import config.env
GLOBAL_CONTEXT = types.MappingProxyType({
"ALLGO_ALLOW_LOCAL_ACCOUNTS": parse_bool(config.env.ALLGO_ALLOW_LOCAL_ACCOUNTS)
})
def global_context(request):
"""This global context is imported in every rendered template"""
return GLOBAL_CONTEXT
......@@ -4,18 +4,21 @@ import os
from django.conf import settings
from django.contrib import auth
from django.contrib.auth.models import User, AnonymousUser
from django.core.exceptions import PermissionDenied
from django.core.validators import MinLengthValidator, MinValueValidator, \
RegexValidator
from django.db import models
from django.db.models.signals import post_save
from django.dispatch import receiver
from taggit.managers import TaggableManager
from allauth.socialaccount.models import SocialAccount
from django.utils.crypto import get_random_string
from .validators import job_param_validator, docker_container_id_validator, \
docker_tag_validator, docker_name_validator, \
sshkey_validator, token_validator
import config.env
......@@ -615,6 +618,10 @@ class Job(TimeStampModel):
@receiver(post_save, sender=User)
def create_user_profile(sender, instance, created, **kwargs):
if created:
if (not config.settings.parse_bool(config.env.ALLGO_ALLOW_LOCAL_ACCOUNTS)
and not SocialAccount.objects.filter(user=instance).exists()):
# creation of local user accounts not allowed
raise PermissionDenied
AllgoUser.objects.create(user=instance)
......
......@@ -6,12 +6,20 @@ body {
/* Margin bottom by footer height */
margin-bottom: 260px;
}
.responsive-img {
width: 100%;
height: auto;
}
/*
* Header
*/
header {
background-color: #343A40;
}
.navbar {
padding-left: 0;
padding-right: 0;
}
/* header .active { */
/* border-bottom: 2px solid #fff; */
/* } */
......@@ -20,7 +28,6 @@ header {
*/
.jumbotron {
color: #989B9E;
/* background: url('../images/jumbotron-background.png') center no-repeat #2B3137; */
background: #2B3137;
border-radius: 0;
}
......@@ -31,9 +38,6 @@ header {
.jumbotron .lead {
font-size: 1.9em;
}
.jumbotron .card label {
color: #586069;
}
.slogan-title {
font-size: 5em;
}
......@@ -48,10 +52,14 @@ header {
.allgo-data {
display: block;
font-size: 3em;
color: #000;
color: #2B3137;
font-weight: lighter;
}
.allgo-data-title {
display: block;
text-transform: capitalize;
color: rgb(108, 122, 137);
}
.home-page-cards {
margin: 2em 0;
}
......@@ -266,6 +274,7 @@ a {
}
.webapp-tags-update {
width: 100%;
}
/* font-awesome disabled buttons
*
......
{% extends "base.html" %}
{% load htmlattrs %}
{% load static %}
{% load static htmlattrs %}
{% block title %}A||GO, algorithms at your fingertips{% endblock %}
......@@ -12,45 +11,16 @@
<h1 class="slogan-title">A<span class="allgo-pipes">||</span>gorithms at your fingertips</h1>
<p class="lead slogan">
A||go is a platform for building and deploying apps that analyze massive
data using containers technology. It has been specifically designed for
science applications.
data. It has been specifically designed for science applications.
</p>
</div>
<div class="col-sm-4 col-md-5">
{% if not user.is_authenticated %}
<div class="card">
<div class="card-body">
<form class="signup" id="signup_form" method="post" action="{% url 'account_signup' %}">
{% csrf_token %}
<div class="form-group">
{# <label for="exampleInputEmail1">Email address</label> #}
{{ signup_form.email.label_tag }}
{{ signup_form.email | attr:"placeholder:you@example.com" | add_class:"form-control" }}
<small id="emailHelp" class="form-text text-muted">We'll never share your email with anyone else.</small>
</div>
<div class="form-group">
{{ signup_form.password1.label_tag }}
{{ signup_form.password1 | attr:"placeholder:Create a password" | add_class:"form-control"}}
<small id="passwordHelp" class="form-text text-muted">Password policy here.</small>
</div>
{% if signup_form.password2 %}
<div class="form-group">
{{ signup_form.password2.label_tag }}
{{ signup_form.password2 | attr:"placeholder:Type your password again" | add_class:"form-control"}}
</div>
{% endif %}
{% if redirect_field_value %}
<input type="hidden" name="{{ redirect_field_name }}" value="{{ redirect_field_value }}" />
{% endif %}
<button type="submit" class="btn btn-primary btn-block">Sign up for A||GO</button>
</form>
</div>
</div>
{% endif %}
<div class="col-sm-4 col-md-5 allgo-visual">
<a href="{% url 'main:webapp_list' %}"
title="Browse the webapps">
<img src="{% static 'images/allgo-visual.png' %}"
class="responsive-img" alt="Allgo workflow" />
</a>
</div>
</div>
</div>
......@@ -59,15 +29,24 @@
<div class="container border-bottom">
<div class="row text-center text-muted">
<div class="col">
<p class="allgo-stats"><span class="allgo-data">{{ webapp_nb }}</span>apps</p>
<p class="allgo-stats border-right">
<span class="allgo-data">{{ webapp_nb }}</span>
<span class="allgo-data-title">apps</span>
</p>
</div>
<div class="col">
<p class="allgo-stats"><span class="allgo-data">{{ job_nb }}</span>jobs</p>
<p class="allgo-stats border-right">
<span class="allgo-data">{{ job_nb }}</span>
<span class="allgo-data-title">jobs</span>
</p>
</div>
<div class="col">
<p class="allgo-stats"><span class="allgo-data">{{ user_nb }}</span>users</p>
<p class="allgo-stats">
<span class="allgo-data">{{ user_nb }}</span>
<span class="allgo-data-title">users</span>
</p>
</div>
</div>
</div>
......
......@@ -22,10 +22,10 @@
<ul>
<li><a href="https://wiki.inria.fr/sed_ren/">/SED/</a></li>
{#
{% comment Will be reintegrated with the RGPD %}
<li><a href="#">Terms</a></li>
<li><a href="#">Privacy</a></li>
#}
{% endcomment %}
</ul>
</div>
......
{% load static activelink %}
{% load static activelink socialaccount%}
<header class="container-fluid">
<div class="container">
......@@ -21,14 +21,21 @@
<ul class="navbar-nav ml-auto">
{% if not user.is_authenticated %}
<li class="nav-item
{% is_active request 'account_login' %}">
<a class="nav-link" href="{% url 'account_login' %}">Sign in</a>
</li>
<li class="nav-item nav-link disabled">or</li>
<li class="nav-item {% is_active request 'account_signup' %}">
<a class="nav-link" href="{% url 'account_signup' %}">Sign up</a>
</li>
{% 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 %}
{% 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>
......@@ -45,7 +52,7 @@
<a class="nav-link" href="{% url 'main:user_detail' %}"><i class="fas fa-user"></i> Profile</a>
</li>
<li class="nav-item {% is_active request 'account_logout' %}">
<a class="nav-link" href="{% url 'account_logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
<a class="btn btn-primary" href="{% url 'account_logout' %}"><i class="fas fa-sign-out-alt"></i> Sign out</a>
</li>
{% endif %}
</ul>
......
......@@ -192,6 +192,10 @@ with env_loader.EnvironmentVarLoader(__name__, "ALLGO_",
env_var("ALLGO_IMPORT_REGISTRY", default="cargo.irisa.fr:8003/allgo/prod/webapp",
help="registry of the legacy allgo instance (for importing 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
#
......
......@@ -220,6 +220,7 @@ TEMPLATES = [
'django.template.context_processors.static',
'django.template.context_processors.tz',
'django.contrib.messages.context_processors.messages',
'main.context_processors.global_context',
],
},
},
......
......@@ -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