Module: ActiveModel::SecurePassword
- Extended by:
- ActiveSupport::Concern
- Included in:
- ActiveRecord::SecurePassword
- Defined in:
- activemodel/lib/active_model/secure_password.rb,
activemodel/lib/active_model/secure_password/argon2_password.rb,
activemodel/lib/active_model/secure_password/bcrypt_password.rb
Defined Under Namespace
Modules: ClassMethods Classes: Argon2Password, BCryptPassword, InstanceMethodsOnActivation
Constant Summary collapse
- DEFAULT_RESET_TOKEN_EXPIRES_IN =
15.minutes
Class Attribute Summary collapse
-
.min_cost ⇒ Object
:nodoc:.
Class Method Summary collapse
-
.algorithm_registry ⇒ Object
Returns the registry of password algorithms.
-
.lookup_algorithm(name) ⇒ Object
Looks up a registered algorithm by name.
-
.register_algorithm(name, algorithm_class) ⇒ Object
Registers a password algorithm for use with has_secure_password.
Methods included from ActiveSupport::Concern
append_features, class_methods, extended, included, prepend_features, prepended
Class Attribute Details
.min_cost ⇒ Object
:nodoc:
14 15 16 |
# File 'activemodel/lib/active_model/secure_password.rb', line 14 def min_cost @min_cost end |
Class Method Details
.algorithm_registry ⇒ Object
Returns the registry of password algorithms
17 18 19 |
# File 'activemodel/lib/active_model/secure_password.rb', line 17 def algorithm_registry @algorithm_registry ||= {} end |
.lookup_algorithm(name) ⇒ Object
Looks up a registered algorithm by name
31 32 33 |
# File 'activemodel/lib/active_model/secure_password.rb', line 31 def lookup_algorithm(name) algorithm_registry[name.to_sym] end |
.register_algorithm(name, algorithm_class) ⇒ Object
Registers a password algorithm for use with has_secure_password
ActiveModel::SecurePassword.register_algorithm :argon2, Argon2Password
The algorithm class will be instantiated when used.
26 27 28 |
# File 'activemodel/lib/active_model/secure_password.rb', line 26 def register_algorithm(name, algorithm_class) algorithm_registry[name.to_sym] = algorithm_class end |