Class: TechnoGate::Contao::Password
Constant Summary collapse
- SALT_SIZE =
23
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(password_hash) ⇒ Password
constructor
A new instance of Password.
- #to_s ⇒ Object
Constructor Details
#initialize(password_hash) ⇒ Password
Returns a new instance of Password.
9 10 11 12 13 14 |
# File 'lib/contao/password.rb', line 9 def initialize(password_hash) password_hash.split(':').tap do |p| @password_hash = p[0] @salt = p[1] end end |
Class Method Details
.create(password) ⇒ Object
16 17 18 19 |
# File 'lib/contao/password.rb', line 16 def self.create(password) salt = generate_salt new "#{hash_password(password, salt)}:#{salt}" end |
Instance Method Details
#to_s ⇒ Object
21 22 23 |
# File 'lib/contao/password.rb', line 21 def to_s "#{@password_hash}:#{@salt}" end |