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

fix: enviar invitación sin link

Usuarie#deliver_invitation además generaba un token cuando no era
necesario y esto es lo que hacía que les usuaries quedaran flotando.
This commit is contained in:
f 2023-03-20 17:22:40 -03:00
parent 72c6c3dcd2
commit 88754ff6ec
5 changed files with 25 additions and 13 deletions

View file

@ -86,7 +86,10 @@ class UsuariesController < ApplicationController
next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes)
usuarie = Usuarie.find_by attributes
usuarie = Usuarie.find_by attributes.tap do |u|
u.send_devise_notification(:invitation_instructions, nil)
end
usuarie ||= Usuarie.invite! attributes
@site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as)

View file

@ -8,12 +8,15 @@
%h1= site.title
%p= site.description
%p= link_to t('devise.mailer.invitation_instructions.accept'),
accept_invitation_url(@resource, invitation_token: @token)
- if @resource.created_by_invite?
%p= link_to t('devise.mailer.invitation_instructions.accept'),
accept_invitation_url(@resource, invitation_token: @token)
- if @resource.invitation_due_at
%p= t('devise.mailer.invitation_instructions.accept_until',
due_date: l(@resource.invitation_due_at,
format: :'devise.mailer.invitation_instructions.accept_until_format'))
- if @resource.invitation_due_at
%p= t('devise.mailer.invitation_instructions.accept_until',
due_date: l(@resource.invitation_due_at,
format: :'devise.mailer.invitation_instructions.accept_until_format'))
- else
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url
%p= t('devise.mailer.invitation_instructions.ignore')

View file

@ -9,11 +9,15 @@
\
= site.description
\
= accept_invitation_url(@resource, invitation_token: @token)
\
- if @resource.invitation_due_at
= t('devise.mailer.invitation_instructions.accept_until',
due_date: l(@resource.invitation_due_at,
format: :'devise.mailer.invitation_instructions.accept_until_format'))
- if @resource.created_by_invite?
= accept_invitation_url(@resource, invitation_token: @token)
\
- if @resource.invitation_due_at
= t('devise.mailer.invitation_instructions.accept_until',
due_date: l(@resource.invitation_due_at,
format: :'devise.mailer.invitation_instructions.accept_until_format'))
- else
= root_url(change_locale_to: @resource.lang)
= t('devise.mailer.invitation_instructions.sign_in')
\
= t('devise.mailer.invitation_instructions.ignore')

View file

@ -23,6 +23,7 @@ en:
accept: "Accept invitation"
accept_until: "This invitation will be due in %{due_date}."
ignore: "If you don't want to accept the invitation, please ignore this email. Your account won't be created until you access the link above and set your password."
sign_in: "Sign in to your account to accept or decline the invitation."
time:
formats:
devise:

View file

@ -23,6 +23,7 @@ es:
accept: "Aceptar la invitación"
accept_until: "La invitación vencerá el %{due_date}."
ignore: "Si no querés aceptar la invitación, por favor ignora este correo. Tu cuenta no será creada hasta que aceptes la invitación y configures una contraseña."
sign_in: "Iniciá sesión con tu cuenta para aceptar o rechazar la invitación."
time:
formats:
devise: