Sprankelprachtig aan/afmeldsysteem

session.rb 351B

1234567891011121314
  1. class Session < ApplicationRecord
  2. belongs_to :user
  3. def Session.new_token
  4. SecureRandom.urlsafe_base64
  5. end
  6. def Session.digest(string)
  7. cost = ActiveModel::SecurePassword.min_cost ? BCrypt::Engine::MIN_COST :
  8. BCrypt::Engine.cost
  9. BCrypt::Password.create(string, cost: cost)
  10. end
  11. end