mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-15 02:11:42 +00:00
fix: confirmar usuaries en la invitación #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
5c467e08b8
commit
229914e849
4 changed files with 16 additions and 2 deletions
|
@ -96,6 +96,12 @@ class UsuariesController < ApplicationController
|
|||
|
||||
# XXX: La invitación tiene que ser enviada luego de crear el rol
|
||||
if role.persisted?
|
||||
# Si es una cuenta manual que no está confirmada aun,
|
||||
# aprovechar para reconfirmarla.
|
||||
if !usuarie.confirmed? && !usuarie.created_by_invite?
|
||||
usuarie.generate_confirmation_token!
|
||||
end
|
||||
|
||||
usuarie.deliver_invitation
|
||||
else
|
||||
raise ArgumentError, role.errors.full_messages
|
||||
|
|
|
@ -51,9 +51,9 @@ class Usuarie < ApplicationRecord
|
|||
end
|
||||
|
||||
# Les usuaries necesitan link de invitación si no tenían cuenta
|
||||
# o todavía no la confirmaron
|
||||
# y todavía no aceptaron la invitación anterior.
|
||||
def needs_invitation_link?
|
||||
(created_by_invite? && !invitation_accepted?) || !confirmed?
|
||||
created_by_invite? && !invitation_accepted?
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
@ -18,5 +18,9 @@
|
|||
format: :'devise.mailer.invitation_instructions.accept_until_format'))
|
||||
|
||||
%p= t('devise.mailer.invitation_instructions.ignore')
|
||||
- elsif !@resource.confirmed? && @resource.confirmation_token
|
||||
= confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang)
|
||||
\
|
||||
= t('devise.mailer.invitation_instructions.ignore')
|
||||
- else
|
||||
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
format: :'devise.mailer.invitation_instructions.accept_until_format'))
|
||||
\
|
||||
= t('devise.mailer.invitation_instructions.ignore')
|
||||
- elsif !@resource.confirmed? && @resource.confirmation_token
|
||||
= confirmation_url(@resource, confirmation_token: @token, change_locale_to: @resource.lang)
|
||||
\
|
||||
= t('devise.mailer.invitation_instructions.ignore')
|
||||
- else
|
||||
= root_url(change_locale_to: @resource.lang)
|
||||
= t('devise.mailer.invitation_instructions.sign_in')
|
||||
|
|
Loading…
Reference in a new issue