From 556740d7bcf783c4f0524ee04a7f7599c134ffe3 Mon Sep 17 00:00:00 2001 From: Jens Langhammer Date: Tue, 26 Feb 2019 15:41:11 +0100 Subject: [PATCH] add PasswordPolicyForm back in --- passbook/core/forms/policies.py | 25 ++++++++++++++++++- .../0015_passwordpolicy_error_message.py | 19 ++++++++++++++ 2 files changed, 43 insertions(+), 1 deletion(-) create mode 100644 passbook/core/migrations/0015_passwordpolicy_error_message.py diff --git a/passbook/core/forms/policies.py b/passbook/core/forms/policies.py index c80a3bbc9..3fd518c1b 100644 --- a/passbook/core/forms/policies.py +++ b/passbook/core/forms/policies.py @@ -3,7 +3,8 @@ from django import forms from django.utils.translation import gettext as _ -from passbook.core.models import DebugPolicy, FieldMatcherPolicy, WebhookPolicy +from passbook.core.models import (DebugPolicy, FieldMatcherPolicy, + PasswordPolicy, WebhookPolicy) GENERAL_FIELDS = ['name', 'action', 'negate', 'order', ] @@ -50,3 +51,25 @@ class DebugPolicyForm(forms.ModelForm): labels = { 'result': _('Allow user') } + + +class PasswordPolicyForm(forms.ModelForm): + """PasswordPolicy Form""" + + class Meta: + + model = PasswordPolicy + fields = GENERAL_FIELDS + ['amount_uppercase', 'amount_lowercase', + 'amount_symbols', 'length_min', 'symbol_charset', + 'error_message'] + widgets = { + 'name': forms.TextInput(), + 'symbol_charset': forms.TextInput(), + 'error_message': forms.TextInput(), + } + labels = { + 'amount_uppercase': _('Minimum amount of Uppercase Characters'), + 'amount_lowercase': _('Minimum amount of Lowercase Characters'), + 'amount_symbols': _('Minimum amount of Symbols Characters'), + 'length_min': _('Minimum Length'), + } diff --git a/passbook/core/migrations/0015_passwordpolicy_error_message.py b/passbook/core/migrations/0015_passwordpolicy_error_message.py new file mode 100644 index 000000000..7181f95f5 --- /dev/null +++ b/passbook/core/migrations/0015_passwordpolicy_error_message.py @@ -0,0 +1,19 @@ +# Generated by Django 2.1.7 on 2019-02-26 14:28 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ('passbook_core', '0014_auto_20190226_0850'), + ] + + operations = [ + migrations.AddField( + model_name='passwordpolicy', + name='error_message', + field=models.TextField(default=''), + preserve_default=False, + ), + ]