Skip to content

Commit

Permalink
add business logic views to login and logout users with magic link
Browse files Browse the repository at this point in the history
  • Loading branch information
vincentporte committed Nov 14, 2024
1 parent 542c9b8 commit 61b5d70
Show file tree
Hide file tree
Showing 10 changed files with 1,023 additions and 0 deletions.
2 changes: 2 additions & 0 deletions config/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from lacommunaute.search import urls as search_urls
from lacommunaute.stats import urls as stats_urls
from lacommunaute.surveys import urls as surveys_urls
from lacommunaute.users import urls as users_urls


conversation_urlpatterns_factory = get_class("forum_conversation.urls", "urlpatterns_factory")
Expand All @@ -31,6 +32,7 @@
# www.
path("", include(pages_urls)),
path("members/", include(forum_member_urls)),
path("users/", include(users_urls)),
path("", include(forum_conversation_extension_urls)),
path("", include(forum_extension_urls)),
path("", include(forum_polls_extension_urls)),
Expand Down
51 changes: 51 additions & 0 deletions lacommunaute/templates/registration/create_user.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
{% extends "board_base.html" %}
{% load i18n %}
{% block sub_title %}
{% trans "Sign in" %}
{% endblock sub_title %}
{% block content %}
<section class="s-title-01 mt-lg-5">
<div class="s-title-01__container container">
<div class="s-title-01__row row">
<div class="s-title-01__col col-12">
<h1 class="s-title-01__title h1">
<strong>{% trans "Sign in" %}</strong>
</h1>
</div>
</div>
</div>
</section>
<section class="s-section">
<div class="s-section__container container">
<div class="s-section__row row">
<div class="s-section__col col-12 col-lg-7">
<div class="card">
<div class="card-body">
Bonjour {{ email }} et bienvenue dans la communauté de l'inclusion, encore quelques informations avant de vous envoyer le lien.
</div>
<div class="c-form">
<form method="post" action="." enctype="multipart/form-data" novalidate>
{% csrf_token %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="alert alert-danger">
<i class="icon-exclamation-sign"></i>
{{ error }}
</div>
{% endfor %}
{% endif %}
{% include "partials/form_field.html" with field=form.email %}
{% include "partials/form_field.html" with field=form.first_name %}
{% include "partials/form_field.html" with field=form.last_name %}
<div class="form-actions">
<input type="hidden" name="next" value="{{ request.GET.next }}" />
<input type="submit" class="btn btn-large btn-primary" value="{% trans "Login with your email" %}" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock content %}
28 changes: 28 additions & 0 deletions lacommunaute/templates/registration/login_link_sent.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
{% extends "layouts/base.html" %}
{% load static %}
{% load i18n %}
{% load theme_inclusion %}
{% block title %}Connexion {{ block.super }}{% endblock %}
{% block meta_description %}
{% trans "Login | Sign in" %}
{% endblock meta_description %}
{% block content %}
<section class="s-title-01 mt-lg-5">
<div class="s-title-01__container container">
<div class="s-title-01__row row">
<div class="s-title-01__col col-lg-8 col-12">
<h1 class="s-title-01__title h1">{% trans "Login | Sign in" %}</h1>
</div>
</div>
</div>
</section>
<section class="s-section">
<div class="s-section__container container">
<div class="s-section__row row">
<div class="s-section__col col-12 col-lg-7">
Un lien de connexion vous a été envoyé à l'adresse {{ email }}. Veuillez vérifier votre boîte de réception et cliquer sur le lien pour vous connecter.
</div>
</div>
</div>
</section>
{% endblock content %}
49 changes: 49 additions & 0 deletions lacommunaute/templates/registration/login_with_magic_link.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
{% extends "layouts/base.html" %}
{% load static %}
{% load i18n %}
{% load theme_inclusion %}
{% block title %}Connexion {{ block.super }}{% endblock %}
{% block meta_description %}
{% trans "Login | Sign in" %}
{% endblock meta_description %}
{% block content %}
<section class="s-title-01 mt-lg-5">
<div class="s-title-01__container container">
<div class="s-title-01__row row">
<div class="s-title-01__col col-lg-8 col-12">
<h1 class="s-title-01__title h1">{% trans "Login | Sign in" %}</h1>
</div>
</div>
</div>
</section>
<section class="s-section">
<div class="s-section__container container">
<div class="s-section__row row">
<div class="s-section__col col-12 col-lg-7">
<div class="card">
<div class="c-form">
<a href="{% url 'openid_connect:authorize' %}?next={{ next }}" rel="nofollow" class="btn btn-outline-primary btn-ico btn-block">Se connecter avec Pro Connect</a>
<hr class="my-5" data-it-text="ou">
<form method="post" action="." enctype="multipart/form-data" novalidate>
{% csrf_token %}
{% if form.non_field_errors %}
{% for error in form.non_field_errors %}
<div class="alert alert-danger">
<i class="icon-exclamation-sign"></i>
{{ error }}
</div>
{% endfor %}
{% endif %}
{% include "partials/form_field.html" with field=form.email %}
<div class="form-actions">
<input type="hidden" name="next" value="{{ request.GET.next }}" />
<input type="submit" class="btn btn-large btn-primary" value="{% trans "Login with your email" %}" />
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</section>
{% endblock content %}
14 changes: 14 additions & 0 deletions lacommunaute/users/forms.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
from django import forms


class LoginForm(forms.Form):
email = forms.EmailField(
label="",
widget=forms.EmailInput(attrs={"placeholder": "Votre adresse email"}),
)


class CreateUserForm(forms.Form):
first_name = forms.CharField(label="Votre prénom", max_length=150)
last_name = forms.CharField(label="Votre nom", max_length=150)
email = forms.EmailField(label="Votre adresse email")
Empty file.
Loading

0 comments on commit 61b5d70

Please sign in to comment.