add PasswordPolicyForm back in

This commit is contained in:
Jens Langhammer 2019-02-26 15:41:11 +01:00
parent 421f51770c
commit 556740d7bc
2 changed files with 43 additions and 1 deletions

View File

@ -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'),
}

View File

@ -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,
),
]