added AuthenticationToken model, updated some restrictions for the authentication token table, added dependent destroy to the user model for authentication tokens

This commit is contained in:
Janis4411
2022-08-02 13:57:44 +02:00
committed by Sebastian Serth
parent fe410a5306
commit d64daadd21
4 changed files with 39 additions and 1 deletions

View File

@ -0,0 +1,14 @@
# frozen_string_literal: true
require 'securerandom'
class AuthenticationToken < ApplicationRecord
include Creation
def self.generate!(user)
create!(
shared_secret: SecureRandom.hex(32),
user: user,
expire_at: 7.days.from_now
)
end
end