mirror of
https://0xacab.org/sutty/sutty
synced 2024-11-26 04:36:20 +00:00
Merge branch 'issue-2123' 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
af53d59e53
3 changed files with 12 additions and 7 deletions
|
@ -83,16 +83,19 @@ class UsuariesController < ApplicationController
|
||||||
# Enviar la invitación si es necesario y agregar al sitio
|
# Enviar la invitación si es necesario y agregar al sitio
|
||||||
invitaciones.each do |invitacion|
|
invitaciones.each do |invitacion|
|
||||||
attributes = { email: invitacion.address }
|
attributes = { email: invitacion.address }
|
||||||
|
options = { skip_invitation: true }
|
||||||
|
|
||||||
next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes)
|
next if Usuarie.where(id: @site.roles.pluck(:usuarie_id)).find_by(attributes)
|
||||||
|
|
||||||
usuarie = Usuarie.find_by attributes.tap do |u|
|
usuarie = Usuarie.find_by attributes
|
||||||
u.send_devise_notification(:invitation_instructions, nil)
|
usuarie ||= Usuarie.invite!(attributes, nil, options).tap do |u|
|
||||||
|
u.generate_invitation_token!
|
||||||
end
|
end
|
||||||
|
|
||||||
usuarie ||= Usuarie.invite! attributes
|
|
||||||
|
|
||||||
@site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as)
|
@site.roles.create(usuarie: usuarie, temporal: true, rol: invited_as)
|
||||||
|
|
||||||
|
# XXX: La invitación tiene que ser enviada luego de crear el rol
|
||||||
|
usuarie.send(:send_devise_notification, :invitation_instructions, nil)
|
||||||
end
|
end
|
||||||
|
|
||||||
redirect_to site_usuaries_path(@site)
|
redirect_to site_usuaries_path(@site)
|
||||||
|
|
|
@ -20,3 +20,5 @@
|
||||||
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url(change_locale_to: @resource.lang)
|
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url(change_locale_to: @resource.lang)
|
||||||
|
|
||||||
%p= t('devise.mailer.invitation_instructions.ignore')
|
%p= t('devise.mailer.invitation_instructions.ignore')
|
||||||
|
- else
|
||||||
|
%p= link_to t('devise.mailer.invitation_instructions.sign_in'), root_url
|
||||||
|
|
|
@ -16,8 +16,8 @@
|
||||||
= t('devise.mailer.invitation_instructions.accept_until',
|
= t('devise.mailer.invitation_instructions.accept_until',
|
||||||
due_date: l(@resource.invitation_due_at,
|
due_date: l(@resource.invitation_due_at,
|
||||||
format: :'devise.mailer.invitation_instructions.accept_until_format'))
|
format: :'devise.mailer.invitation_instructions.accept_until_format'))
|
||||||
|
\
|
||||||
|
= t('devise.mailer.invitation_instructions.ignore')
|
||||||
- else
|
- else
|
||||||
= root_url(change_locale_to: @resource.lang)
|
= root_url(change_locale_to: @resource.lang)
|
||||||
= t('devise.mailer.invitation_instructions.sign_in')
|
= t('devise.mailer.invitation_instructions.sign_in')
|
||||||
\
|
|
||||||
= t('devise.mailer.invitation_instructions.ignore')
|
|
||||||
|
|
Loading…
Reference in a new issue