From 906ca841dfc9b72f4d72bc6fe763a463b95d6e67 Mon Sep 17 00:00:00 2001 From: Frederic Date: Thu, 19 Sep 2013 20:27:54 +0200 Subject: [PATCH] fix: setting an ampty PIN works now --- cash/views.py | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/cash/views.py b/cash/views.py index 4fa7a72..7e9885a 100644 --- a/cash/views.py +++ b/cash/views.py @@ -78,13 +78,17 @@ class UserSettingsForm(forms.Form): class UserPinForm(forms.Form): pin = forms.CharField(max_length=32, widget=forms.PasswordInput, - label=ugettext_lazy('PIN')) + label=ugettext_lazy('PIN'), required=False) pin_confirm = forms.CharField(max_length=32, widget=forms.PasswordInput, - label=ugettext_lazy('PIN (confirmation)')) + label=ugettext_lazy('PIN (confirmation)'), + required=False) def clean(self): cleaned_data = super(UserPinForm, self).clean() - + + if not (cleaned_data.has_key('pin') or + cleaned_data.has_key('pin_confirm')): + return cleaned_data if cleaned_data['pin'] != cleaned_data['pin_confirm']: raise forms.ValidationError(_('PINs do not match.')) @@ -126,3 +130,5 @@ def usersettings(request, submit=None): + +