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
All checks were successful
ci/woodpecker/push/woodpecker Pipeline was successful
This commit is contained in:
commit
fc3731a9ac
1 changed files with 10 additions and 0 deletions
|
@ -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
|
||||
|
|
Loading…
Reference in a new issue