mirror of
https://github.com/we-promise/sure.git
synced 2026-05-07 21:04:12 +00:00
* feat(auth): add WebAuthn MFA credentials * fix(auth): harden WebAuthn MFA review paths * fix(auth): polish WebAuthn error handling * fix(auth): handle duplicate WebAuthn credential races * fix(auth): permit WebAuthn credential params * fix(auth): trim WebAuthn registration controller cleanup * fix(auth): tighten WebAuthn MFA handling * fix(auth): pin WebAuthn relying party config
16 lines
513 B
Ruby
16 lines
513 B
Ruby
class WebauthnCredential < ApplicationRecord
|
|
belongs_to :user
|
|
|
|
before_validation :set_default_nickname
|
|
|
|
validates :nickname, presence: true, length: { maximum: 80 }
|
|
validates :credential_id, presence: true, uniqueness: true
|
|
validates :public_key, presence: true
|
|
validates :sign_count, numericality: { greater_than_or_equal_to: 0, only_integer: true }
|
|
|
|
private
|
|
def set_default_nickname
|
|
self.nickname = nickname.to_s.strip.presence || I18n.t("webauthn_credentials.default_name")
|
|
end
|
|
end
|