Git Product home page Git Product logo

django-password-strength's Introduction

Django Password Strength

An extension of the Django password widget including a password strength meter and crack time powered by zxcvbn.

Empty Password

Weak Password

Strong Password

Install:

> pip install django-password-strength

Usage:

  • Add django_password_strength to the installed apps of your Django Project
  • Instead of using the django PasswordInput widget use the PasswordStrengthInput
  • Be sure to include the form's required media in the template. ie. {{ form.media }}
  • If you bundle your js you can use django_password_strength/js/zxcvbn.js or django_password_strength/js/zxcvbn-async.js and django_password_strength/js/password_strength.js instead
  • For easiest integration also include Twitter Bootstrap

Translations:

There are currently no translations already available, but all the text is translatable, you just have to translate it yourself.

For the javascript translations be sure to add the javascript translation catalog provided by django or use something like django-statici18n for a static version of the catalog. If you don't want translations you don't have to add the catalog to your page.

Example:

forms.py

from django import forms
from django_password_strength.widgets import PasswordStrengthInput, PasswordConfirmationInput

class SignupForm(forms.Form):
    username = forms.CharField()
    passphrase = forms.CharField(
        widget=PasswordStrengthInput()
    )
    confirm_passphrase = forms.CharField(
        widget=PasswordConfirmationInput()
    )

Example using multiple password fields:

forms.py

from django import forms
from django_password_strength.widgets import PasswordStrengthInput, PasswordConfirmationInput

class SignupForm(forms.Form):
    username = forms.CharField()
    passphrase = forms.CharField(
        widget=PasswordStrengthInput()
    )
    confirm_passphrase = forms.CharField(
        widget=PasswordConfirmationInput(confirm_with='passphrase')
    )

    passphrase2 = forms.CharField(
        widget=PasswordStrengthInput()
    )
    confirm_passphrase2 = forms.CharField(
        widget=PasswordConfirmationInput(confirm_with='passphrase2')
    )

django-password-strength's People

Contributors

aj-may avatar kupuguy avatar levkowetz avatar snoepkast avatar

Stargazers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.