diff --git a/CHANGELOG b/CHANGELOG index 83431994..26c4cbd4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,5 @@ === master +* Make rodauth.has_password? method public (enescakir) (#461) * Fix strict_unused_block warnings when running specs on Ruby 3.4 (jeremyevans) diff --git a/lib/rodauth/features/base.rb b/lib/rodauth/features/base.rb index 15e9d98d..84e66f74 100644 --- a/lib/rodauth/features/base.rb +++ b/lib/rodauth/features/base.rb @@ -542,6 +542,12 @@ def possible_authentication_methods has_password? ? ['password'] : [] end + def has_password? + return @has_password if defined?(@has_password) + return false unless account || session_value + @has_password = !!get_password_hash + end + private def _around_rodauth @@ -718,12 +724,6 @@ def function_name(name) end end - def has_password? - return @has_password if defined?(@has_password) - return false unless account || session_value - @has_password = !!get_password_hash - end - def password_hash_using_salt(password, salt) BCrypt::Engine.hash_secret(password, salt) end