5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-20 07:26:22 +00:00

Merge branch 'issue-13247' into panel.sutty.nl
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful

This commit is contained in:
f 2023-04-24 17:05:17 -03:00
commit fc3731a9ac

View file

@ -12,6 +12,7 @@ class Usuarie < ApplicationRecord
validates_with EmailAddress::ActiveRecordValidator, field: :email
before_create :lang_from_locale!
before_update :accept_invitation_after_confirmation!
has_many :roles
has_many :sites, through: :roles
@ -54,4 +55,13 @@ class Usuarie < ApplicationRecord
def lang_from_locale!
self.lang = I18n.locale.to_s
end
# Si le usuarie (re)confirma su cuenta con una invitación pendiente,
# considerarla aceptada también.
def accept_invitation_after_confirmation!
if confirmed?
self.invitation_token = nil
self.invitation_accepted_at ||= Time.now.utc
end
end
end