2019-03-03 16:12:05 +00:00
|
|
|
"""passbook PasswordExpiry Policy forms"""
|
|
|
|
|
|
|
|
from django import forms
|
2019-03-10 17:34:09 +00:00
|
|
|
from django.contrib.admin.widgets import FilteredSelectMultiple
|
2019-03-03 16:12:05 +00:00
|
|
|
from django.utils.translation import gettext as _
|
|
|
|
|
|
|
|
from passbook.core.forms.policies import GENERAL_FIELDS
|
|
|
|
from passbook.password_expiry_policy.models import PasswordExpiryPolicy
|
|
|
|
|
|
|
|
|
|
|
|
class PasswordExpiryPolicyForm(forms.ModelForm):
|
|
|
|
"""Edit PasswordExpiryPolicy instances"""
|
|
|
|
|
|
|
|
class Meta:
|
|
|
|
|
|
|
|
model = PasswordExpiryPolicy
|
|
|
|
fields = GENERAL_FIELDS + ['days', 'deny_only']
|
|
|
|
widgets = {
|
|
|
|
'name': forms.TextInput(),
|
|
|
|
'order': forms.NumberInput(),
|
|
|
|
'days': forms.NumberInput(),
|
2019-03-10 17:34:09 +00:00
|
|
|
'policies': FilteredSelectMultiple(_('policies'), False)
|
2019-03-03 16:12:05 +00:00
|
|
|
}
|
|
|
|
labels = {
|
|
|
|
'deny_only': _("Only fail the policy, don't set user's password.")
|
|
|
|
}
|