Files
codeocean/app/models/authentication_token.rb
2022-11-25 11:10:06 +01:00

18 lines
341 B
Ruby

# frozen_string_literal: true
require 'securerandom'
class AuthenticationToken < ApplicationRecord
include Creation
belongs_to :study_group, optional: true
def self.generate!(user, study_group)
create!(
shared_secret: SecureRandom.hex(32),
user:,
expire_at: 7.days.from_now,
study_group:
)
end
end