Module: PasswordHelper

Defined in:
lib/users/password_helper.rb

Overview

This module contains functions for hashing and storing passwords

Class Method Summary collapse

Class Method Details

.check(password, store) ⇒ Object

Checks the password against the stored password


16
17
18
19
20
21
22
23
24
25
# File 'lib/users/password_helper.rb', line 16

def self.check(password, store)
  hash = self.get_hash(store)
  salt = self.get_salt(store)
  if self.hash(password,salt) == hash
    true

  else
    false
  end
end

.update(password) ⇒ Object

Generates a new salt and rehashes the password


9
10
11
12
13
# File 'lib/users/password_helper.rb', line 9

def self.update(password)
  salt = self.salt
  hash = self.hash(password,salt)
  self.store(hash, salt)
end