Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
< Back to tools
D

devise_zxcvbn

> 编程语言
Open source

Devise plugin to reject weak passwords using zxcvbn

199 stars0 likes2 views
WebsiteGitHub

About

Devise plugin to reject weak passwords using zxcvbn

devise_zxcvbn

Plugin for devise to reject weak passwords, using zxcvbn-rb which is a ruby port of zxcvbn: realistic password strength estimation.

The user's password will be rejected if the score is below 4 by default. It also uses the email as user input to zxcvbn, to reject passwords containing parts of the email (if using zxcvbn.js on the frontend you should also do this to get the same score).

The scores 0, 1, 2, 3 or 4 are given when the estimated crack time (seconds) is less than 10**2, 10**4, 10**6, 10**8, Infinity.

Installation

Add this line to your application's Gemfile:

ruby
gem 'devise_zxcvbn'

Configuration

…

Default parameters

A score of less than 3 is not recommended.

ruby
# config/initializers/devise.rb
Devise.setup do |config|
  config.min_password_score = 4
end

Error Message

The default error message:

yaml
"not strong enough. It scored %{score}. It must score at least %{min_password_score}."

You can customize this error message modifying the devise YAML file.

The crack_time_display, feedback, score and min_password_score variables are passed through if you need them.

yaml
# config/locales/devise.en.yml
en:
  errors:
    messages:
      weak_password: "not strong enough. Consider adding a number, symbols or more letters to make it stronger."

Skipping password complexity validation

To turn off password complexity validation for certain conditions, you could implement a concern (or similar) that overloads skip_password_complexity?:

ruby
def skip_password_complexity?
  true
end

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Add test coverage for the feature, We use rspec for this purpose
  4. Commit your changes (git commit -am 'Add some feature')
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request

License

devise_zxcvbn is Copyright © 2013 Bit Zesty. It is free software, and may be redistributed under the terms specified in the LICENSE file.

About Bit Zesty

devise_zxcvbn is maintained by Bit Zesty Limited. The names and logos for Bit Zesty are trademarks of Bit Zesty Limited.

See our other projects or hire us to design, develop, and support your product or service.

Issues· 0 open

View all issuesOpen on GitHub

No open issues yet, or sync has not completed.

> Tags

Ruby

No comments yet. Be the first to share.

> Details

PublishedAug 1, 2026
UpdatedSep 18, 2026
Category编程语言
PricingOpen source

> Related tools

T
TypeScript
JavaScript 的超集,为前端与全栈提供静态类型
P
Python
通用编程语言,广泛用于 Web、数据与 AI
G
Go
Google 推出的简洁高效系统语言