8
0
Fork 0
mirror of https://gitlab2.federez.net/re2o/re2o synced 2024-11-24 20:33:11 +00:00

Add specific index page for the captive portal

This commit is contained in:
Yohann D'ANELLO 2021-02-01 03:43:16 +01:00
parent c4a93927a2
commit b063ae783c
No known key found for this signature in database
GPG key ID: 3A75C55819C8CF85
3 changed files with 61 additions and 2 deletions

View file

@ -0,0 +1,48 @@
{% extends "base.html" %}
{% load i18n %}
{% block content %}
<div class="panel-heading">
<h2>{% blocktrans trimmed with asso_name=asso.name %}Welcome onto the captive portal of {{ asso_name }}!{% endblocktrans %}</h2>
</div>
<div class="row">
{% if not user.is_authenticated %}
<div class="col-sm-6 col-md-6">
<div class="col-12">
<div class="thumbnail">
<div class="caption">
<h3>{% trans "Registration" %}</h3>
<p>{% trans "If you don't have an account yet and you want to access the Internet and the organisation's services, create your own personal account." %}</p>
<p><a href="{% url 'portail:signup' %}" class="btn btn-primary" role="button">{% trans "Sign up" %}</a></p>
</div>
</div>
</div>
</div>
<div class="col-sm-6 col-md-6">
<div class="col-12">
<div class="thumbnail">
<div class="caption">
<h3>{% trans "Logging in" %}</h3>
<p>{% trans "If you already have an account, log in. You can manage your subscriptions to the organisation." %}</p>
<p><a href="{% url 'portail:login' %}" class="btn btn-primary" role="button">{% trans "Log in" %}</a></p>
</div>
</div>
</div>
</div>
{% else %}
<div class="col-sm-12 col-md-12">
<div class="col-12">
<div class="thumbnail">
<div class="caption">
<h3>{% trans "My subscriptions" %}</h3>
<p>{% trans "To renew your Internet connection, you can extend your current connection." %}</p>
<p><a href="{% url 'portail:extend-connection' userid=request.user.pk %}" class="btn btn-primary" role="button">{% trans "Buy a new subscription" %}</a></p>
</div>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}

View file

@ -29,9 +29,10 @@ from cotisations.views import new_facture
from django.conf.urls import url from django.conf.urls import url
from django.contrib.auth.views import LoginView from django.contrib.auth.views import LoginView
from .views import SignUpView from .views import IndexView, SignUpView
urlpatterns = [ urlpatterns = [
url(r"^$", IndexView.as_view(), name="index"),
url(r"^signup/$", SignUpView.as_view(), name="signup"), url(r"^signup/$", SignUpView.as_view(), name="signup"),
url(r"^login/$", LoginView.as_view(), name="login"), url(r"^login/$", LoginView.as_view(), name="login"),
url(r"^extend-connection/(?P<userid>[0-9]+)/$", new_facture, name="extend-connection"), url(r"^extend-connection/(?P<userid>[0-9]+)/$", new_facture, name="extend-connection"),

View file

@ -24,7 +24,8 @@ from cotisations.utils import find_payment_method
from django.contrib.auth import login from django.contrib.auth import login
from django.db import transaction from django.db import transaction
from django.urls import reverse_lazy from django.urls import reverse_lazy
from django.views.generic import CreateView from django.views.generic import CreateView, TemplateView
from preferences.models import AssoOption
from .forms import AdherentForm, MembershipForm from .forms import AdherentForm, MembershipForm
@ -83,3 +84,12 @@ class SignUpView(CreateView):
def get_success_url(self): def get_success_url(self):
return reverse_lazy("users:profil", args=(self.object.pk,)) return reverse_lazy("users:profil", args=(self.object.pk,))
class IndexView(TemplateView):
template_name = "portail/index.html"
def get_context_data(self, **kwargs):
context = super().get_context_data(**kwargs)
context["asso"] = AssoOption.objects.get_or_create()[0]
return context