# Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information.
#
from allauth.socialaccount.forms import SignupForm
-from django.contrib.auth.forms import UserCreationForm
+from django.contrib.auth.forms import AuthenticationForm, UserCreationForm
from django.contrib.auth.models import User
from newsletter.forms import NewsletterForm
+class WLAuthenticationForm(AuthenticationForm):
+ template_name = '2022/form.html'
+
+
# has to be this order, because otherwise the form is lacking fields
class RegistrationForm(UserCreationForm, NewsletterForm):
data_processing_part2 = '''\
line-height: 150%;
margin-bottom: 30px;
}
+
}
+
+.socialaccount_providers {
+ list-style: none;
+ padding: 0;
+
+ li {
+ display: inline-block;
+ margin-right: 10px;
+ }
+}
+
--- /dev/null
+{% extends "2022/base.html" %}
+{% load i18n %}
+
+{% block content %}
+ <div class="l-container">
+ <div class="l-breadcrumb">
+ <a href="/"><span>Strona główna</span></a>
+ <a>Zaloguj się</a>
+ </div>
+ </div>
+
+ <main class="l-main">
+ <div class="l-checkout__box" style="margin-bottom: 70px;">
+ <div class="l-checkout__box__header">
+ <div class="l-checkout__box__header__content">
+ <h1>Zaloguj się</h1>
+ </div>
+ </div>
+ <div class="l-checkout__cols">
+ <div class="l-checkout__col"></div>
+ <div class="l-checkout__col">
+ <form method="post">
+ <div class="l-checkout__form">
+ {% csrf_token %}
+ {{ form }}
+ <div class="l-checkout__form__row confirm">
+ <div class="l-checkout__input">
+ <button style="margin-left:0">Dalej</button>
+ </div>
+ </div>
+
+ <a href="{% url 'account_reset_password' %}">{% trans "Forgot Password?" %}</a>
+ </div>
+ </form>
+
+ {% if USE_OPENID %}
+ <h3>{% trans "Sign in using:" %}</h3>
+
+ <ul class="socialaccount_providers">
+ {% include "socialaccount/snippets/provider_list.html" %}
+ </ul>
+
+ {% include "socialaccount/snippets/login_extra.html" %}
+ {% endif %}
+
+ </div>
+ </div>
+ </div>
+ </main>
+{% endblock %}
from django.contrib import auth
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
+from django.contrib.auth.views import LoginView
from django.core.cache import cache
from django.http import HttpResponse, HttpResponseRedirect
from django.shortcuts import render
from catalogue.models import Book, Collection, Tag, Fragment
from social.utils import get_or_choose_cite
-from wolnelektury.forms import RegistrationForm, SocialSignupForm
+from wolnelektury.forms import RegistrationForm, SocialSignupForm, WLAuthenticationForm
@never_cache
return render(request, "main_page.html", ctx)
+class WLLoginView(LoginView):
+ form_class = WLAuthenticationForm
+
+
+wl_login_view = WLLoginView.as_view()
+
+
class LoginFormView(AjaxableFormView):
form_class = AuthenticationForm
template = "auth/login.html"
ajax_redirect = True
def __call__(self, request):
+ if request.EXPERIMENTS['layout'].value:
+ return wl_login_view(request)
+
if request.user.is_authenticated:
return self.redirect_or_refresh(
request, '/',