Ruby module enforcing password validation rules for Spree user models. Reuse to add configurable password strength checks to e-commerce authentication flows.
# Source: https://github.com/spree/spree | License: BSD-3-Clause | Copyright 2024-present, Vendo Sp. z o.o., Vendo Connect Inc
# Provided via justclaw.it.com; keep this notice with the code.
module Spree
# Password policy for the default auth models (Customer, AdminUser).
#
# The policy itself lives in {Spree.password_validator} — by default
# {Spree::PasswordLengthValidator}. Swap that to replace it wholesale.
#
# Validation runs only while a password is actually being set, so raising the
# floor on an existing install invalidates no stored digest — short legacy
# passwords keep working until their owner next changes them.
module PasswordPolicy
extend ActiveSupport::Concern
included do
validates :password, confirmation: true, allow_blank: true
# Res
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search for more like it.
Get a free API key