mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 10:11:42 +00:00
fix: aceptar la invitación al confirmar la cuenta #13247
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:
parent
29f4c7a847
commit
1cf5ca5953
1 changed files with 10 additions and 0 deletions
|
@ -12,6 +12,7 @@ class Usuarie < ApplicationRecord
|
||||||
validates_with EmailAddress::ActiveRecordValidator, field: :email
|
validates_with EmailAddress::ActiveRecordValidator, field: :email
|
||||||
|
|
||||||
before_create :lang_from_locale!
|
before_create :lang_from_locale!
|
||||||
|
before_update :accept_invitation_after_confirmation!
|
||||||
|
|
||||||
has_many :roles
|
has_many :roles
|
||||||
has_many :sites, through: :roles
|
has_many :sites, through: :roles
|
||||||
|
@ -54,4 +55,13 @@ class Usuarie < ApplicationRecord
|
||||||
def lang_from_locale!
|
def lang_from_locale!
|
||||||
self.lang = I18n.locale.to_s
|
self.lang = I18n.locale.to_s
|
||||||
end
|
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
|
end
|
||||||
|
|
Loading…
Reference in a new issue