diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index d768b45..a828832 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -357,7 +357,12 @@ class ApplicationController < LinguaFrancaApplicationController end def confirm(uid = nil) - @confirmation = EmailConfirmation.find_by_token!(params[:token]) + @confirmation = EmailConfirmation.find_by_token(params[:token]) + + unless @confirmation.present? + @token_not_found = true + return do_404 + end confirm_user = nil if uid.is_a?(User) diff --git a/app/controllers/conferences_controller.rb b/app/controllers/conferences_controller.rb index d96418a..979537b 100644 --- a/app/controllers/conferences_controller.rb +++ b/app/controllers/conferences_controller.rb @@ -2064,11 +2064,16 @@ class ConferencesController < ApplicationController return registration_steps(registration.conference).last end + rescue_from ActiveRecord::RecordNotFound do |exception| + do_404 + end + rescue_from ActiveRecord::PremissionDenied do |exception| if logged_in? redirect_to :register else @register_template = :confirm_email + @page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details" render :register end end diff --git a/app/views/application/404.html.haml b/app/views/application/404.html.haml index 03af722..658b07c 100644 --- a/app/views/application/404.html.haml +++ b/app/views/application/404.html.haml @@ -1,5 +1,9 @@ = render :partial => 'application/header', :locals => {:image_file => nil} = row do = columns(medium: 12) do - %p= _'error.404.description', :p - = render 'contact', cancel_btn: false, contact_reason: :website \ No newline at end of file + - if @token_not_found.present? + %p= _'error.404.token_not_found', :p + = render 'login', dest: settings_path + - else + %p= _'error.404.description', :p + = render 'contact', cancel_btn: false, contact_reason: :website \ No newline at end of file diff --git a/app/views/application/user_settings.html.haml b/app/views/application/user_settings.html.haml index c3f1dac..d2a32c7 100644 --- a/app/views/application/user_settings.html.haml +++ b/app/views/application/user_settings.html.haml @@ -13,7 +13,6 @@ - @conferences.each do | conference | = link_to (_!conference.title), administration_step_path(conference.slug, :edit), class: :button - = form_tag update_settings_path do = textfield :name, current_user.name, required: true, heading: 'articles.conference_registration.headings.name', big: true = checkboxes :languages, User.AVAILABLE_LANGUAGES, current_user.languages || [I18n.locale], 'languages', heading: 'articles.conference_registration.headings.languages' @@ -23,7 +22,4 @@ = button_tag :save, value: :save - else %h2=_'forms.actions.generic.login' - = form_tag do_confirm_path, class: 'flex-form' do - = emailfield :email, nil, big: true - = button_tag :continue, :value => :confirm_email - = link_to (_'forms.actions.generic.facebook_sign_in','Facebook Sign In'), auth_at_provider_path(provider: :facebook), class: [:button, :facebook] + = render 'login' \ No newline at end of file diff --git a/config/locales/en.yml b/config/locales/en.yml index fd28c46..d90fa40 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -5787,6 +5787,7 @@ en: '404': description: The page you are looking for could not be found. If you think this was in error, please contact us. title: '404: This page doesn''t exist' + token_not_found: Your login token was expired or not found. Please try signing in again. locale_not_available: description: This site has yet to be translated into %{language}. We are actively looking for volunteers who can translate existing copy and new copy as we add new features. If you think you can help, please contact us! title: '404: %{language} Translations Missing' diff --git a/config/locales/es.yml b/config/locales/es.yml index 094a971..d83a87f 100644 --- a/config/locales/es.yml +++ b/config/locales/es.yml @@ -1107,6 +1107,7 @@ es: '404': title: '404: Esta página no existe' description: La página que buscas no pudo ser encontrada. Si piensas que esto fue un error, por favor contáctanos. + token_not_found: El token de inicio de sesión se ha caducado o no se encuentra. Por favor intenta acceder de nuevo. '403': title: Lo sentimos. Por el momento no tienes acceso a esta página description: Por el momento no tienes los permisos suficientes para acceder a esta página. Si crees que esto es un error, por favor contáctanos.