enviar mails de confirmacion con formato correcto
This commit is contained in:
parent
a96d077d6d
commit
57d0fa0c8e
8 changed files with 25 additions and 7 deletions
|
@ -1,2 +1,3 @@
|
||||||
SECRET_KEY_BASE=
|
SECRET_KEY_BASE=
|
||||||
IMAP_SERVER=
|
IMAP_SERVER=
|
||||||
|
DEFAULT_FROM=
|
||||||
|
|
|
@ -22,13 +22,14 @@ class InvitadxsController < ApplicationController
|
||||||
|
|
||||||
if @invitadx.save
|
if @invitadx.save
|
||||||
InvitadxMailer.with(site: @site, invitadx: @invitadx).confirmation_required.deliver
|
InvitadxMailer.with(site: @site, invitadx: @invitadx).confirmation_required.deliver
|
||||||
redirect_to invitadx_path(@invitadx)
|
redirect_to site_invitadx_path(@site, @invitadx)
|
||||||
else
|
else
|
||||||
render 'new'
|
render 'new'
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
def show
|
def show
|
||||||
|
@site = Site.find(params[:site_id])
|
||||||
@has_cover = true
|
@has_cover = true
|
||||||
@invitadx = Invitadx.find(params[:id])
|
@invitadx = Invitadx.find(params[:id])
|
||||||
end
|
end
|
||||||
|
|
|
@ -2,6 +2,6 @@ class InvitadxMailer < ApplicationMailer
|
||||||
def confirmation_required
|
def confirmation_required
|
||||||
@invitadx = params[:invitadx]
|
@invitadx = params[:invitadx]
|
||||||
@site = params[:site]
|
@site = params[:site]
|
||||||
mail to: @invitadx.email, subject: t('.subject')
|
mail from: "#{@site.config.dig('title')} <#{ENV.fetch('DEFAULT_FROM', 'sutty@kefir.red')}>", to: @invitadx.email, subject: t('.subject')
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
.row.align-items-center.justify-content-center.full-height
|
.row.align-items-center.justify-content-center.full-height
|
||||||
.col-md-6.align-self-center
|
.col-md-6.align-self-center
|
||||||
= t('.confirmation_sent')
|
.alert{role: 'alert', class: "alert-success"}
|
||||||
|
= t('.confirmation_sent')
|
||||||
|
|
|
@ -90,7 +90,7 @@ Rails.application.configure do
|
||||||
config.action_mailer.perform_deliveries = true
|
config.action_mailer.perform_deliveries = true
|
||||||
config.action_mailer.raise_delivery_errors = true
|
config.action_mailer.raise_delivery_errors = true
|
||||||
config.action_mailer.delivery_method = :sendmail
|
config.action_mailer.delivery_method = :sendmail
|
||||||
config.action_mailer.default_options = { from: 'sutty@kefir.red' }
|
config.action_mailer.default_options = { from: ENV.fetch('DEFAULT_FROM', 'sutty@kefir.red') }
|
||||||
|
|
||||||
config.middleware.use ExceptionNotification::Rack,
|
config.middleware.use ExceptionNotification::Rack,
|
||||||
email: {
|
email: {
|
||||||
|
|
|
@ -15,6 +15,11 @@ en:
|
||||||
reorder: "We're sorry, we couldn't reorder the articles"
|
reorder: "We're sorry, we couldn't reorder the articles"
|
||||||
disordered: "The posts are disordered, this will prevent you from reordering them!"
|
disordered: "The posts are disordered, this will prevent you from reordering them!"
|
||||||
disordered_button: 'Reorder!'
|
disordered_button: 'Reorder!'
|
||||||
|
invitadx_mailer:
|
||||||
|
confirmation_required:
|
||||||
|
subject: "Confirm your e-mail address"
|
||||||
|
hi: "Hi!"
|
||||||
|
body: "Please open this link to confirm your e-mail address."
|
||||||
invitadxs:
|
invitadxs:
|
||||||
index:
|
index:
|
||||||
title: Guests
|
title: Guests
|
||||||
|
@ -25,6 +30,8 @@ en:
|
||||||
submit: Register
|
submit: Register
|
||||||
confirmation:
|
confirmation:
|
||||||
confirmed: 'Your account is confirmed, please log in to continue'
|
confirmed: 'Your account is confirmed, please log in to continue'
|
||||||
|
show:
|
||||||
|
confirmation_sent: "We've sent a confirmation link to your e-mail address. Please open that link to continue."
|
||||||
info:
|
info:
|
||||||
posts:
|
posts:
|
||||||
reorder: "The articles have been reordered!"
|
reorder: "The articles have been reordered!"
|
||||||
|
|
|
@ -15,6 +15,11 @@ es:
|
||||||
reorder: "Lo sentimos, no pudimos reordenar los artículos."
|
reorder: "Lo sentimos, no pudimos reordenar los artículos."
|
||||||
disordered: 'Los artículos no tienen número de orden, esto impedirá que los puedas reordenar'
|
disordered: 'Los artículos no tienen número de orden, esto impedirá que los puedas reordenar'
|
||||||
disordered_button: '¡Reordenar!'
|
disordered_button: '¡Reordenar!'
|
||||||
|
invitadx_mailer:
|
||||||
|
confirmation_required:
|
||||||
|
subject: "Confirma tu dirección de correo"
|
||||||
|
hi: "¡Hola!"
|
||||||
|
body: "Por favor abre esta dirección para confirmar tu cuenta de correo."
|
||||||
invitadxs:
|
invitadxs:
|
||||||
index:
|
index:
|
||||||
title: Invitadxs
|
title: Invitadxs
|
||||||
|
@ -25,6 +30,8 @@ es:
|
||||||
submit: Registrarme
|
submit: Registrarme
|
||||||
confirmation:
|
confirmation:
|
||||||
confirmed: 'Tu cuenta está confirmada, ahora puedes ingresar'
|
confirmed: 'Tu cuenta está confirmada, ahora puedes ingresar'
|
||||||
|
show:
|
||||||
|
confirmation_sent: "Te hemos enviado un correo de confirmación a tu casilla, por favor confirma tu cuenta antes de continuar."
|
||||||
info:
|
info:
|
||||||
posts:
|
posts:
|
||||||
reorder: "¡Los artículos fueron reordenados!"
|
reorder: "¡Los artículos fueron reordenados!"
|
||||||
|
|
|
@ -9,13 +9,14 @@ Rails.application.routes.draw do
|
||||||
|
|
||||||
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
|
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
|
||||||
|
|
||||||
resources :invitadxs, only: [:create, :show] do
|
# XXX Mantenemos solo esta ruta acá porque form_for no reconoce @site
|
||||||
end
|
# como un objeto válido
|
||||||
|
resources :invitadxs, only: [:create]
|
||||||
|
|
||||||
resources :sites, only: [:index, :show], constraints: { site_id: /[^\/]+/, id: /[^\/]+/ } do
|
resources :sites, only: [:index, :show], constraints: { site_id: /[^\/]+/, id: /[^\/]+/ } do
|
||||||
resources :posts
|
resources :posts
|
||||||
resources :templates
|
resources :templates
|
||||||
resources :invitadxs, only: [:index, :new] do
|
resources :invitadxs, only: [:index, :new, :show] do
|
||||||
get :confirmation, to: 'invitadxs#confirmation'
|
get :confirmation, to: 'invitadxs#confirmation'
|
||||||
end
|
end
|
||||||
get :'invitadxs/login/new', to: 'login#new'
|
get :'invitadxs/login/new', to: 'login#new'
|
||||||
|
|
Loading…
Reference in a new issue