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

Merge branch 'issue-13247' of https://0xacab.org/sutty/sutty into panel.sutty.nl

This commit is contained in:
Sutty 2023-04-24 20:44:38 +00:00
commit 596e22d5ec
4 changed files with 16 additions and 2 deletions

View file

@ -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

View file

@ -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

View file

@ -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(change_locale_to: @resource.lang)

View file

@ -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')