From bd3b2ce8c52e19c3345864473b1da369c8ab27e5 Mon Sep 17 00:00:00 2001 From: f Date: Fri, 28 Sep 2018 12:00:50 -0300 Subject: [PATCH] confirmar la cuenta e ingresar al sitio --- app/controllers/invitadxs_controller.rb | 5 ++++- app/controllers/login_controller.rb | 3 ++- config/locales/en.yml | 2 ++ config/locales/es.yml | 2 ++ config/routes.rb | 2 ++ 5 files changed, 12 insertions(+), 2 deletions(-) diff --git a/app/controllers/invitadxs_controller.rb b/app/controllers/invitadxs_controller.rb index 3906c70..3e2854f 100644 --- a/app/controllers/invitadxs_controller.rb +++ b/app/controllers/invitadxs_controller.rb @@ -41,7 +41,10 @@ class InvitadxsController < ApplicationController if @invitadx.confirmation_token = params[:confirmation_token] @invitadx.update_attribute :confirmed, true - redirect_to site_ + flash[:info] = t('.confirmed') + redirect_to site_invitadxs_login_new_path(@site) + else + redirect_to root_path end end diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 3ab0b55..e6ac36f 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -7,13 +7,14 @@ class LoginController < ApplicationController def new @has_cover = true + @site = Site.find(params[:site_id]) if params[:site_id].present? render 'login/new' end def create authenticate session[:lang] = params[:lang] - referer = request.referer unless /\/login\// =~ request.referer + referer = request.referer unless /\/login/ =~ request.referer if authenticated? redirect_to referer || sites_path diff --git a/config/locales/en.yml b/config/locales/en.yml index 9bcfec0..8be8106 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -23,6 +23,8 @@ en: password: Password password_confirmation: Repeat password submit: Register + confirmation: + confirmed: 'Your account is confirmed, please log in to continue' info: posts: reorder: "The articles have been reordered!" diff --git a/config/locales/es.yml b/config/locales/es.yml index aba594a..f392465 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -23,6 +23,8 @@ es: password: Contraseña password_confirmation: Repite la contraseña submit: Registrarme + confirmation: + confirmed: 'Tu cuenta está confirmada, ahora puedes ingresar' info: posts: reorder: "¡Los artículos fueron reordenados!" diff --git a/config/routes.rb b/config/routes.rb index af6d6e6..3c9b784 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -18,6 +18,8 @@ Rails.application.routes.draw do resources :invitadxs, only: [:index, :new] do get :confirmation, to: 'invitadxs#confirmation' end + get :'invitadxs/login/new', to: 'login#new' + post :'invitadxs/login', to: 'login#create' get 'i18n', to: 'i18n#index' get 'i18n/edit', to: 'i18n#edit'