Module: DeviseAuthenticator
- Defined in:
- lib/devise_authenticator.rb,
lib/devise_authenticator/version.rb
Defined Under Namespace
Classes: Config
Constant Summary collapse
- VERSION =
"0.0.3"
Class Method Summary collapse
- .hash_password(password) ⇒ Object
- .setup ⇒ Object
- .valid_password?(password, encrypted_password) ⇒ Boolean
Class Method Details
.hash_password(password) ⇒ Object
16 17 18 |
# File 'lib/devise_authenticator.rb', line 16 def hash_password(password) BCrypt::Password.create("#{password}#{@@config.pepper}").to_s end |
.setup ⇒ Object
7 8 9 |
# File 'lib/devise_authenticator.rb', line 7 def setup @@config = yield DeviseAuthenticator::Config.new end |
.valid_password?(password, encrypted_password) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/devise_authenticator.rb', line 11 def valid_password?(password, encrypted_password) bc = BCrypt::Password.new(encrypted_password) hashed_password = BCrypt::Engine.hash_secret("#{password}#{@@config.pepper}", bc.salt) hashed_password == encrypted_password end |