diff options
Diffstat (limited to 'ishtar_common')
| -rw-r--r-- | ishtar_common/templates/registration/form.html (renamed from ishtar_common/templates/registration/password_change_form.html) | 2 | ||||
| -rw-r--r-- | ishtar_common/templates/registration/login.html | 6 | ||||
| -rw-r--r-- | ishtar_common/templates/registration/registration_closed.html | 12 | ||||
| -rw-r--r-- | ishtar_common/templates/registration/registration_form.html | 9 | ||||
| -rw-r--r-- | ishtar_common/urls_registration.py | 2 | ||||
| -rw-r--r-- | ishtar_common/views.py | 25 | 
6 files changed, 48 insertions, 8 deletions
diff --git a/ishtar_common/templates/registration/password_change_form.html b/ishtar_common/templates/registration/form.html index deb7af503..f75a82c0f 100644 --- a/ishtar_common/templates/registration/password_change_form.html +++ b/ishtar_common/templates/registration/form.html @@ -5,7 +5,7 @@  <div class="container">    <div class="row justify-content-center">      <div class="col-lg-4 col-md-6 col-sm-10"> -      <h3 class="text-center">{% trans "Change password" %}</h3> +      <h3 class="text-center">{{page_title}}</h3>        <form method="post" action=".">{% csrf_token %}          {% if form.non_field_errors %}          <div class="form-group row"> diff --git a/ishtar_common/templates/registration/login.html b/ishtar_common/templates/registration/login.html index adefb3176..de7c28317 100644 --- a/ishtar_common/templates/registration/login.html +++ b/ishtar_common/templates/registration/login.html @@ -35,8 +35,10 @@  <hr/>  <div class="row justify-content-center">      <div class="col-md-6"> -        <small class="text-secondary">{% trans "Forgot password?" %} <a href="{% url 'password_reset' %}">{% trans "Reset it" %}</a> – -        {% trans "Not member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a></small> +        <small class="text-secondary">{% trans "Forgot password?" %} <a href="{% url 'password_reset' %}">{% trans "Reset it" %}</a> +        {% if registration_open %}– +        {% trans "Not member?" %} <a href="{% url 'registration_register' %}">{% trans "Register" %}</a> +        {% endif %}</small>      </div>  </div>  {% endblock %} diff --git a/ishtar_common/templates/registration/registration_closed.html b/ishtar_common/templates/registration/registration_closed.html new file mode 100644 index 000000000..7e68ad378 --- /dev/null +++ b/ishtar_common/templates/registration/registration_closed.html @@ -0,0 +1,12 @@ +{% extends "base.html" %} +{% load i18n %} + +{% block content %} +<div class="container"> +  <div class="row justify-content-center"> +    <div class="col-lg-4 col-md-6 col-sm-10"> +      <p>{% trans "Registration are closed." %}</p> +    </div> +  </div> +</div> +{% endblock %} diff --git a/ishtar_common/templates/registration/registration_form.html b/ishtar_common/templates/registration/registration_form.html index b15f0e74b..e6c7c42e2 100644 --- a/ishtar_common/templates/registration/registration_form.html +++ b/ishtar_common/templates/registration/registration_form.html @@ -2,10 +2,11 @@  {% load i18n %}  {% block content %} -<div class='form'> -<form method="post" action=".">{% csrf_token %} -  <table> -  <caption>{% trans "Register" %}</caption> +<div class="container"> +  <div class="row justify-content-center"> +    <div class="col-lg-4 col-md-6 col-sm-10"> +      <h3 class="text-center">{% trans "Register" %}</h3> +      <form method="post" action=".">{% csrf_token %}    {{ form.as_table }}    <tr><td colspan='2'><input type="submit" value="{% trans 'Submit' %}" /></td></tr>    </table> diff --git a/ishtar_common/urls_registration.py b/ishtar_common/urls_registration.py index 085af2f87..97209646f 100644 --- a/ishtar_common/urls_registration.py +++ b/ishtar_common/urls_registration.py @@ -25,7 +25,7 @@ urlpatterns = [          registration_views.ActivationView.as_view(),          name='registration_activate'),      url(r'^accounts/register/$', -        registration_views.RegistrationView.as_view(), +        views.RegistrationView.as_view(),          name='registration_register'),      url(r'^accounts/register/complete/$',          TemplateView.as_view( diff --git a/ishtar_common/views.py b/ishtar_common/views.py index c10da588a..64934a1d0 100644 --- a/ishtar_common/views.py +++ b/ishtar_common/views.py @@ -25,6 +25,7 @@ import json  import logging  import os  import re +from registration import views as registration_views  import unicodedata  import urllib.parse @@ -177,6 +178,11 @@ def index(request):  class LoginView(AuthLoginView):      form_class = forms.AuthenticationForm +    def get_context_data(self, **kwargs): +        context = super().get_context_data(**kwargs) +        context["registration_open"] = settings.REGISTRATION_OPEN +        return context +  class LogoutView(AuthLogoutView):      def get(self, request, *args, **kwargs): @@ -203,6 +209,7 @@ def update_password_last_update(user):  class PasswordChangeView(AuthPasswordChangeView):      form_class = forms.PasswordChangeForm      success_url = reverse_lazy('start') +    template_name = 'registration/form.html'      def form_valid(self, form):          returned = super().form_valid(form) @@ -210,6 +217,11 @@ class PasswordChangeView(AuthPasswordChangeView):          messages.add_message(self.request, messages.INFO, _("Password changed"))          return returned +    def get_context_data(self, **kwargs): +        context = super().get_context_data(**kwargs) +        context["page_title"] = _("Change password") +        return context +  class PasswordResetConfirmView(AuthPasswordResetConfirmView):      def form_valid(self, form): @@ -218,6 +230,19 @@ class PasswordResetConfirmView(AuthPasswordResetConfirmView):          return returned +class RegistrationView(registration_views.RegistrationView): +    template_name = 'registration/form.html' + +    def get_context_data(self, **kwargs): +        context = super().get_context_data(**kwargs) +        context["page_title"] = _("Register") +        return context + +    def register(self, form): +        # TODO +        raise NotImplementedError + +  person_search_wizard = wizards.PersonSearch.as_view(      [("general-person_search", forms.PersonFormSelection)],      label=_("Person search"),  | 
