Password field for Django with the eye icon to show/hide password text
Project description
A Django field and widget to show the ‘eye’ icon that shows and hides password.
Requirements
Font Awesome. It is included in the widget by default.
Install
` pip install django-password-eye `
In settings, add django_password_eye to INSTALLED_APPS:
By default, it includes the Font Awesome css library
If you do not want to include it because you already include it from another template, just set this in your settings file:
` DJANGO_PASSWORD_EYE_INCLUDE_FONT_AWESOME = False `
Usage
Import PasswordEye and use it instead of the traditional Password field.
from django_password_eye.fields import PasswordEye
- class LoginForm(forms.Form):
- username = forms.CharField(max_length=150,
widget=forms.TextInput(attrs={‘class’: ‘form-control’, ‘placeholder’: _(‘Login’)}), label=’’)
password = PasswordEye(label=’’)
Independent behavior for inputs
In case you need to trigger the show/hide password for any PasswordEye field, just create it as follows:
input = PasswordEye(independent=True)
CSS classes
By using the css class django_password_eye as selector, you can customize the entire widget. Check template input.html.
I suggest to modify link class to add cursor: hand/pointer, but it is up to you.
Source code
The code was taken from this link
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file django_password_eye-1.1.3.tar.gz
.
File metadata
- Download URL: django_password_eye-1.1.3.tar.gz
- Upload date:
- Size: 43.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d297e0889991c349d915c80fbadb4d7ab646087cfbedb6b5e4abfa4d16148732 |
|
MD5 | 4ff142047f0ea9b292ef3caf21c071c7 |
|
BLAKE2b-256 | 28a051b6bc4818f6f437278bb21eb656b8bf1bdf9b1d372ce190021a4a7e049f |
File details
Details for the file django_password_eye-1.1.3-py3-none-any.whl
.
File metadata
- Download URL: django_password_eye-1.1.3-py3-none-any.whl
- Upload date:
- Size: 31.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.11.10
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 236e2e563ba1ef3f745495bf4bb11ebebcd642efab765e4bc52085253b51f7f3 |
|
MD5 | 008ebf63b473e2234da61b34608aa877 |
|
BLAKE2b-256 | f6cf47a22e8f1d156f75c099482b219838b6a08bb929b9326bd75d46e7dbcec4 |