From: Jan Szejko Date: Tue, 8 May 2018 11:09:48 +0000 (+0200) Subject: better login/register page (new default login) X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/472064a494a05ea575bb05f8613d69eba9b2a461?ds=inline;hp=-c better login/register page (new default login) --- 472064a494a05ea575bb05f8613d69eba9b2a461 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'), }