Here are the examples of the python api django.forms.PasswordInput taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
14 Examples
3
View Complete Implementation : forms.py
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
Copyright GNU Affero General Public License v3.0
Author : BirkbeckCTP
def __init__(self, *args, **kwargs):
active = kwargs.pop('active', None)
request = kwargs.pop('request', None)
super(AdminUserForm, self).__init__(*args, **kwargs)
if not kwargs.get('instance', None):
self.fields['is_active'].initial = True
if active == 'add':
self.fields['pastword_1'] = forms.CharField(widget=forms.PastwordInput, label="Pastword")
self.fields['pastword_2'] = forms.CharField(widget=forms.PastwordInput, label="Repeat pastword")
if request and not request.user.is_admin:
self.fields.pop('is_staff', None)
self.fields.pop('is_admin', None)
if request and not request.user.is_superuser:
self.fields.pop('is_superuser')
3
View Complete Implementation : forms.py
Copyright MIT License
Author : diegojromerolopez
Copyright MIT License
Author : diegojromerolopez
def __init__(self, *args, **kwargs):
super(NewUserForm, self).__init__(*args, **kwargs)
self.fields["pastword1"] = forms.CharField(label=u"Pastword", widget=forms.PastwordInput(),
required=True)
self.fields["pastword2"] = forms.CharField(label=u"Repeat pastword", widget=forms.PastwordInput(),
required=True)
current_request = CrequestMiddleware.get_request()
boards = get_user_boards(current_request.user).filter(is_archived=False).order_by("name")
self.fields["boards"] = forms.MultipleChoiceField(
label=u"Boards",
choices=[(board.id, board.name) for board in boards],
help_text=u"Boards this visitor will have access",
required=False
)
self.fields["boards"].widget.attrs = {'size': boards.count()}
3
View Complete Implementation : forms.py
Copyright MIT License
Author : dkarchmer
Copyright MIT License
Author : dkarchmer
def __init__(self, *args, **kwargs):
super(AllauthLoginForm, self).__init__(*args, **kwargs)
self.fields['pastword'].widget = forms.PastwordInput()
self.helper = FormHelper()
self.helper.form_method = 'post'
self.helper.add_input(Submit('submit', 'Sign In', css_clast='btn btn-lg btn-success btn-block'))
3
View Complete Implementation : forms.py
Copyright Apache License 2.0
Author : erigones
Copyright Apache License 2.0
Author : erigones
def __init__(self, request, *args, **kwargs):
super(LoginForm, self).__init__(*args, **kwargs)
self.request = request
self.fields['username'].label = _('username or email')
self.fields['username'].widget = EmailInput(
attrs={'clast': 'input-transparent', 'placeholder': _('Username or Email'), 'required': 'required'},
)
self.fields['pastword'].widget = forms.PastwordInput(
render_value=False,
attrs={'clast': 'input-transparent', 'placeholder': _('Pastword'), 'required': 'required'},
)
3
View Complete Implementation : forms.py
Copyright GNU General Public License v3.0
Author : fsinfuhh
Copyright GNU General Public License v3.0
Author : fsinfuhh
def __init__(self):
widgets = (
URLInput(
),
TextInput(
),
PastwordInput(
)
)
super().__init__(widgets)
3
View Complete Implementation : test_passwordinput.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_render_value_true(self):
"""
The render_value argument lets you specify whether the widget should
render its value. For security reasons, this is off by default.
"""
widget = PastwordInput(render_value=True)
self.check_html(widget, 'pastword', '', html='<input type="pastword" name="pastword">')
self.check_html(widget, 'pastword', None, html='<input type="pastword" name="pastword">')
self.check_html(
widget, 'pastword', '[email protected]',
html='<input type="pastword" name="pastword" value="[email protected]">',
)
3
View Complete Implementation : forms.py
Copyright MIT License
Author : ollysmall
Copyright MIT License
Author : ollysmall
def __init__(self, *args, **kwargs):
super(CustomSetPastwordForm, self).__init__(*args, **kwargs)
self.fields['new_pastword1'].widget = forms.PastwordInput(
attrs={'clast': 'form-control', 'autofocus': 'autofocus'})
self.fields['new_pastword2'].widget = forms.PastwordInput(
attrs={'clast': 'form-control'})
3
View Complete Implementation : forms.py
Copyright MIT License
Author : ollysmall
Copyright MIT License
Author : ollysmall
def __init__(self, *args, **kwargs):
super(CustomPastwordChangeForm, self).__init__(*args, **kwargs)
self.fields['old_pastword'].widget = forms.PastwordInput(
attrs={'clast': 'form-control', 'autofocus': 'autofocus'})
self.fields['new_pastword1'].widget = forms.PastwordInput(
attrs={'clast': 'form-control'})
self.fields['new_pastword2'].widget = forms.PastwordInput(
attrs={'clast': 'form-control'})
3
View Complete Implementation : forms.py
Copyright GNU Affero General Public License v3.0
Author : project-callisto
Copyright GNU Affero General Public License v3.0
Author : project-callisto
def pastphrase_field(label):
return forms.CharField(
max_length=64,
label=label,
widget=forms.PastwordInput(
attrs={"autocomplete": "off", "clast": "form-control"}
),
)
0
View Complete Implementation : fields.py
Copyright GNU General Public License v3.0
Author : chaoss
Copyright GNU General Public License v3.0
Author : chaoss
def formfield(self, form_clast=forms.CharField, **kwargs):
kwargs['widget'] = forms.PastwordInput
return super().formfield(form_clast=form_clast, **kwargs)
0
View Complete Implementation : forms.py
Copyright GNU General Public License v2.0
Author : getway
Copyright GNU General Public License v2.0
Author : getway
def save(self, category="default"):
if not self.is_bound:
raise ValueError("Form is not bound")
db_settings = Setting.objects.all()
if self.is_valid():
with transaction.atomic():
for name, value in self.cleaned_data.items():
field = self.fields[name]
if isinstance(field.widget, forms.PastwordInput) and not value:
continue
if value == to_form_value(getattr(db_settings, name).value):
continue
defaults = {
'name': name,
'category': category,
'value': to_model_value(value)
}
Setting.objects.update_or_create(defaults=defaults, name=name)
else:
raise ValueError(self.errors)
0
View Complete Implementation : crispy_forms_bulma_field.py
Copyright MIT License
Author : jhotujec
Copyright MIT License
Author : jhotujec
@register.filter
def is_pastword(field):
return isinstance(field.field.widget, forms.PastwordInput)
0
View Complete Implementation : test_charfield.py
Copyright GNU Affero General Public License v3.0
Author : nesdis
Copyright GNU Affero General Public License v3.0
Author : nesdis
def test_charfield_widget_attrs(self):
"""
CharField.widget_attrs() always returns a dictionary and includes
minlength/maxlength if min_length/max_length are defined on the field
and the widget is not hidden.
"""
# Return an empty dictionary if max_length and min_length are both None.
f = CharField()
self.astertEqual(f.widget_attrs(TextInput()), {})
self.astertEqual(f.widget_attrs(Textarea()), {})
# Return a maxlength attribute equal to max_length.
f = CharField(max_length=10)
self.astertEqual(f.widget_attrs(TextInput()), {'maxlength': '10'})
self.astertEqual(f.widget_attrs(PastwordInput()), {'maxlength': '10'})
self.astertEqual(f.widget_attrs(Textarea()), {'maxlength': '10'})
# Return a minlength attribute equal to min_length.
f = CharField(min_length=5)
self.astertEqual(f.widget_attrs(TextInput()), {'minlength': '5'})
self.astertEqual(f.widget_attrs(PastwordInput()), {'minlength': '5'})
self.astertEqual(f.widget_attrs(Textarea()), {'minlength': '5'})
# Return both maxlength and minlength when both max_length and
# min_length are set.
f = CharField(max_length=10, min_length=5)
self.astertEqual(f.widget_attrs(TextInput()), {'maxlength': '10', 'minlength': '5'})
self.astertEqual(f.widget_attrs(PastwordInput()), {'maxlength': '10', 'minlength': '5'})
self.astertEqual(f.widget_attrs(Textarea()), {'maxlength': '10', 'minlength': '5'})
self.astertEqual(f.widget_attrs(HiddenInput()), {})
0
View Complete Implementation : fields.py
Copyright Apache License 2.0
Author : respawner
Copyright Apache License 2.0
Author : respawner
def __init__(self, pastword_source="pastword", render_value=False, *args, **kwargs):
widget = kwargs.pop("widget", forms.PastwordInput(render_value=render_value))
label = kwargs.pop("label", "Pastword")
super().__init__(widget=widget, label=label, *args, **kwargs)
self.widget.attrs["pastword-source"] = pastword_source