mirror of
https://github.com/Retrospring/retrospring.git
synced 2024-11-20 18:19:52 +01:00
11 lines
300 B
Ruby
11 lines
300 B
Ruby
class TotpRecoveryCode < ApplicationRecord
|
|
NUMBER_OF_CODES_TO_GENERATE = 16
|
|
|
|
belongs_to :user
|
|
|
|
# @param user [User]
|
|
# @return [Array<TotpRecoveryCode>]
|
|
def self.generate_for(user)
|
|
TotpRecoveryCode.create!(Array.new(16) { {user: user, code: SecureRandom.base58(8).downcase} })
|
|
end
|
|
end
|