From 472064a494a05ea575bb05f8613d69eba9b2a461 Mon Sep 17 00:00:00 2001 From: Jan Szejko Date: Tue, 8 May 2018 13:09:48 +0200 Subject: [PATCH] better login/register page (new default login) --- src/ajaxable/templates/ajaxable/form.html | 2 +- src/wolnelektury/settings/auth.py | 2 +- .../templates/auth/login_register.html | 13 +-------- src/wolnelektury/templates/auth/register.html | 27 ++++++------------- .../templates/auth/register_form.html | 11 ++++++++ src/wolnelektury/views.py | 2 +- 6 files changed, 23 insertions(+), 34 deletions(-) create mode 100644 src/wolnelektury/templates/auth/register_form.html diff --git a/src/ajaxable/templates/ajaxable/form.html b/src/ajaxable/templates/ajaxable/form.html index 3363bc8a4..0af34f4cc 100755 --- a/src/ajaxable/templates/ajaxable/form.html +++ b/src/ajaxable/templates/ajaxable/form.html @@ -3,7 +3,7 @@

{{ title }}

-
{% ssi_csrf_token %} {% if honeypot %} diff --git a/src/wolnelektury/settings/auth.py b/src/wolnelektury/settings/auth.py index 2034db716..e704dc611 100644 --- a/src/wolnelektury/settings/auth.py +++ b/src/wolnelektury/settings/auth.py @@ -7,7 +7,7 @@ AUTHENTICATION_BACKENDS = [ # 'allauth.account.auth_backends.AuthenticationBackend', ] ACCOUNT_EMAIL_CONFIRMATION_EXPIRE_DAYS = 2 -LOGIN_URL = '/uzytkownik/login/' +LOGIN_URL = '/uzytkownik/zaloguj-utworz/' LOGIN_REDIRECT_URL = '/' diff --git a/src/wolnelektury/templates/auth/login_register.html b/src/wolnelektury/templates/auth/login_register.html index 31d137cdc..6be20540a 100755 --- a/src/wolnelektury/templates/auth/login_register.html +++ b/src/wolnelektury/templates/auth/login_register.html @@ -6,16 +6,5 @@ {% block extra %} {{ block.super }} -

{% trans "or register" %}:

- - - {% ssi_csrf_token %} - {% render_honeypot_field %} -
    -
    - {{ register_form.as_ul }} -
  1. -
-
+ {% include "auth/register_form.html" with form=register_form title=_("or register") action_url='register' action_query=request.GET.urlencode honeypot=True submit=register_submit %} {% endblock %} diff --git a/src/wolnelektury/templates/auth/register.html b/src/wolnelektury/templates/auth/register.html index 967fc6fa0..684943866 100644 --- a/src/wolnelektury/templates/auth/register.html +++ b/src/wolnelektury/templates/auth/register.html @@ -1,27 +1,16 @@ -{% extends "ajaxable/form.html" %} {% load i18n %} -{% load ajaxable_tags %} -{% block form_fields %} - {{ form.username|pretty_field }} - {{ form.email|pretty_field }} - {{ form.password1|pretty_field }} - {{ form.password2|pretty_field }} - {{ form.agree_newsletter|pretty_checkbox }} -{% endblock %} - - -{% block extra %} +{% include "auth/register_form.html" %} {% if USE_OPENID %} -

{% trans "Sign in using:" %}

+
+

{% trans "Sign in using:" %}

- + -{% include "socialaccount/snippets/login_extra.html" %} + {% include "socialaccount/snippets/login_extra.html" %} +
{% endif %} - -{% endblock %} diff --git a/src/wolnelektury/templates/auth/register_form.html b/src/wolnelektury/templates/auth/register_form.html new file mode 100644 index 000000000..d9fb6a17d --- /dev/null +++ b/src/wolnelektury/templates/auth/register_form.html @@ -0,0 +1,11 @@ +{% extends "ajaxable/form.html" %} +{% load ajaxable_tags %} + + +{% block form_fields %} + {{ form.username|pretty_field }} + {{ form.email|pretty_field }} + {{ form.password1|pretty_field }} + {{ form.password2|pretty_field }} + {{ form.agree_newsletter|pretty_checkbox }} +{% endblock %} \ No newline at end of file diff --git a/src/wolnelektury/views.py b/src/wolnelektury/views.py index c62c2e585..6108122c7 100644 --- a/src/wolnelektury/views.py +++ b/src/wolnelektury/views.py @@ -115,7 +115,7 @@ class LoginRegisterFormView(LoginFormView): def extra_context(self, request, obj): return { - "register_form": placeholdized(UserCreationForm(prefix='register')), + "register_form": placeholdized(RegistrationForm(prefix='register')), "register_submit": _('Register'), } -- 2.20.1