5
0
Fork 0
mirror of https://0xacab.org/sutty/sutty synced 2024-11-14 17:41:41 +00:00

enviar mails de confirmacion con formato correcto

This commit is contained in:
f 2018-10-02 15:16:56 -03:00
parent a96d077d6d
commit 57d0fa0c8e
No known key found for this signature in database
GPG key ID: F3FDAB97B5F9F7E7
8 changed files with 25 additions and 7 deletions

View file

@ -1,2 +1,3 @@
SECRET_KEY_BASE=
IMAP_SERVER=
DEFAULT_FROM=

View file

@ -22,13 +22,14 @@ class InvitadxsController < ApplicationController
if @invitadx.save
InvitadxMailer.with(site: @site, invitadx: @invitadx).confirmation_required.deliver
redirect_to invitadx_path(@invitadx)
redirect_to site_invitadx_path(@site, @invitadx)
else
render 'new'
end
end
def show
@site = Site.find(params[:site_id])
@has_cover = true
@invitadx = Invitadx.find(params[:id])
end

View file

@ -2,6 +2,6 @@ class InvitadxMailer < ApplicationMailer
def confirmation_required
@invitadx = params[:invitadx]
@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

View file

@ -1,3 +1,4 @@
.row.align-items-center.justify-content-center.full-height
.col-md-6.align-self-center
= t('.confirmation_sent')
.alert{role: 'alert', class: "alert-success"}
= t('.confirmation_sent')

View file

@ -90,7 +90,7 @@ Rails.application.configure do
config.action_mailer.perform_deliveries = true
config.action_mailer.raise_delivery_errors = true
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,
email: {

View file

@ -15,6 +15,11 @@ en:
reorder: "We're sorry, we couldn't reorder the articles"
disordered: "The posts are disordered, this will prevent you from reordering them!"
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:
index:
title: Guests
@ -25,6 +30,8 @@ en:
submit: Register
confirmation:
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:
posts:
reorder: "The articles have been reordered!"

View file

@ -15,6 +15,11 @@ es:
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_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:
index:
title: Invitadxs
@ -25,6 +30,8 @@ es:
submit: Registrarme
confirmation:
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:
posts:
reorder: "¡Los artículos fueron reordenados!"

View file

@ -9,13 +9,14 @@ Rails.application.routes.draw do
get '/sites/:site_id/public/:type/:basename', to: 'sites#send_public_file'
resources :invitadxs, only: [:create, :show] do
end
# XXX Mantenemos solo esta ruta acá porque form_for no reconoce @site
# como un objeto válido
resources :invitadxs, only: [:create]
resources :sites, only: [:index, :show], constraints: { site_id: /[^\/]+/, id: /[^\/]+/ } do
resources :posts
resources :templates
resources :invitadxs, only: [:index, :new] do
resources :invitadxs, only: [:index, :new, :show] do
get :confirmation, to: 'invitadxs#confirmation'
end
get :'invitadxs/login/new', to: 'login#new'