Refactor authentication token for new study-group-based authorization
This commit is contained in:

committed by
Sebastian Serth

parent
cb1b163b30
commit
936c11e31f
@ -6,11 +6,12 @@ class AuthenticationToken < ApplicationRecord
|
||||
include Creation
|
||||
belongs_to :study_group, optional: true
|
||||
|
||||
def self.generate!(user)
|
||||
def self.generate!(user, study_group)
|
||||
create!(
|
||||
shared_secret: SecureRandom.hex(32),
|
||||
user: user,
|
||||
expire_at: 7.days.from_now
|
||||
expire_at: 7.days.from_now,
|
||||
study_group: study_group
|
||||
)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user