Commit af357960 authored by BERJON Matthieu's avatar BERJON Matthieu

Deletion of current authentification system

I decided to use django-allauth for authentification because by default
it proposes both registration and oauth2.
Signed-off-by: BERJON Matthieu's avatarMatthieu Berjon <matthieu.berjon@inria.fr>
parent a159b938
from django.conf.urls import url, include
from . import views
app_name = 'account'
urlpatterns = [
# Registration
url(r'^', include('django.contrib.auth.urls')),
url(r'^signup/$', views.SignUp.as_view(), name='signup'),
]
from django.contrib.auth.forms import UserCreationForm
from django.urls import reverse_lazy
from django.views.generic import CreateView
class SignUp(CreateView):
form_class = UserCreationForm
success_url = reverse_lazy('account:login')
template_name = 'registration/signup.html'
{% extends 'base.html' %}
{% block title %}Login{% endblock %}
{% block content %}
<h2>Login</h2>
<form method="post">
{% csrf_token %}
<div class="form-group">
{{ form.as_p }}
</div>
<button class="btn btn-primary" type="submit">Login</button>
</form>
<p><a href="{% url 'account:signup' %}">Register</a> - <a href="{% url 'account:password_reset' %}">Forgot your password?</a></p>
{% endblock %}
{% extends 'base.html' %}
{% block title %}Password reset complete{% endblock %}
{% block content %}
<p>
Your password has been set. You may go ahead and <a href="{% url 'login' %}">log in</a> now.
</p>
{% endblock %}
{% extends 'base.html' %}
{% block title %}Change your password{% endblock %}
{% block content %}
{% if validlink %}
<h2>Change password</h2>
<form method="post">
{% csrf_token %}
{{ form.as_p }}
<button type="submit">Change password</button>
</form>
{% else %}
<p>
The password reset link was invalid, possibly because it has already been used.
Please request a new password reset.
</p>
{% endif %}
{% endblock %}
{% extends 'base.html' %}
{% block title %}Email sent{% endblock %}
{% block content %}
<p>
We've emailed you instructions for setting your password, if an account
exists with the email you entered. You should receive them shortly.
</p>
<p>
If you don't receive an email, please make sure you've entered the address
you registered with, and check your spam folder.
</p>
{% endblock %}
{% autoescape off %}
To initiate the password reset process for your {{ user.get_username }} A||go Account,
click the link below:
{{ protocol }}://{{ domain }}{% url 'password_reset_confirm' uidb64=uid token=token %}
If clicking the link above doesn't work, please copy and paste the URL in a new browser
window instead.
Sincerely,
The A||go Team
{% endautoescape %}
{% extends 'base.html' %}
{% block title %}Reset your password{% endblock %}
{% block content %}
<h2>Forgot password</h2>
<form method="post">
{% csrf_token %}
<div class="form-group">
{{ form.as_p }}
</div>
<button class="btn btn-primary" type="submit">Submit</button>
</form>
{% endblock %}
{% extends 'base.html' %}
{% block title %}Sign up{% endblock %}
{% block content %}
<h2>Sign up</h2>
<form method="post">
{% csrf_token %}
<div class="form-group">
<div class="row">
<div class="col">
{% for field in form %}
<p>{{ field.label_tag }} {{ field }}</p>
{% for error in field.errors %}
<div class="alert alert-danger alert-dismissible fade show" role="alert">
{{ error }}
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
</div>
{% endfor %}
{% endfor %}
</div>
<div class="col">
{% for field in form %}
{% if field.help_text %}
{{ field.help_text|safe }}
{% endif %}
{% endfor %}
</div>
</div>
</div>
<button class="btn btn-primary" type="submit">Sign up</button>
</form>
{% endblock %}
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