Move factor base template to form_with_user

This commit is contained in:
Jens Langhammer 2019-02-23 20:41:43 +01:00
parent 5fa8711bfa
commit 66c0fc9d9a
4 changed files with 9 additions and 5 deletions

View File

@ -17,7 +17,7 @@ class AuthenticationFactor(TemplateView):
authenticator = None
pending_user = None
request = None
template_name = 'login/factors/base.html'
template_name = 'login/form_with_user.html'
def __init__(self, authenticator):
self.authenticator = authenticator
@ -27,5 +27,5 @@ class AuthenticationFactor(TemplateView):
kwargs['is_login'] = True
kwargs['title'] = _('Log in to your account')
kwargs['primary_action'] = _('Log in')
kwargs['pending_user'] = self.pending_user
kwargs['user'] = self.pending_user
return super().get_context_data(**kwargs)

View File

@ -79,6 +79,10 @@ class SignUpForm(forms.Form):
def clean_password_repeat(self):
"""Check if Password adheres to filter and if passwords matche"""
password = self.cleaned_data.get('password')
password_repeat = self.cleaned_data.get('password_repeat')
if password != password_repeat:
raise ValidationError(_("Passwords don't match"))
# TODO: Password policy? Via Plugin? via Policy?
# return check_password(self)
return self.cleaned_data.get('password_repeat')

View File

@ -1,4 +1,4 @@
{% extends 'login/factors/base.html' %}
{% extends 'login/form_with_user.html' %}
{% load i18n %}

View File

@ -23,8 +23,8 @@
{% block above_form %}
<div class="form-group login-pf-settings">
<p class="form-control-static">
<img src="{% gravatar pending_user.email %}" alt="">
{{ pending_user.username }}
<img src="{% gravatar user.email %}" alt="">
{{ user.username }}
</p>
<a href="{% url 'passbook_core:auth-login' %}">{% trans 'Not you?' %}</a>
</div>