Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use proc to set password length validator so it's possible to override it dynamically. #5734

Merged
merged 1 commit into from
Nov 29, 2024

Conversation

nashby
Copy link
Collaborator

@nashby nashby commented Nov 29, 2024

This change is useful for instances where applications have the need to support dynamic password lengths, without a system restart. Such applications will just have to override the password_length method in their own classes to support dynamic password lengths.

Gitlab uses it like this:

class User < ApplicationRecord
  ...
  class << self
    # Devise method overridden to allow support for dynamic password lengths
    def password_length
      Gitlab::CurrentSettings.minimum_password_length..Devise.password_length.max
    end
  end
end

@nashby nashby merged commit fec67f9 into main Nov 29, 2024
40 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant