Added better handling of record not found and invalid login tokens
This commit is contained in:
parent
973ca46c08
commit
94433dde28
@ -357,7 +357,12 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def confirm(uid = nil)
|
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
|
confirm_user = nil
|
||||||
if uid.is_a?(User)
|
if uid.is_a?(User)
|
||||||
|
@ -2064,11 +2064,16 @@ class ConferencesController < ApplicationController
|
|||||||
return registration_steps(registration.conference).last
|
return registration_steps(registration.conference).last
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||||
|
do_404
|
||||||
|
end
|
||||||
|
|
||||||
rescue_from ActiveRecord::PremissionDenied do |exception|
|
rescue_from ActiveRecord::PremissionDenied do |exception|
|
||||||
if logged_in?
|
if logged_in?
|
||||||
redirect_to :register
|
redirect_to :register
|
||||||
else
|
else
|
||||||
@register_template = :confirm_email
|
@register_template = :confirm_email
|
||||||
|
@page_title = "articles.conference_registration.headings.#{@this_conference.registration_status == :open ? '': 'Pre_'}Registration_Details"
|
||||||
render :register
|
render :register
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
= render :partial => 'application/header', :locals => {:image_file => nil}
|
= render :partial => 'application/header', :locals => {:image_file => nil}
|
||||||
= row do
|
= row do
|
||||||
= columns(medium: 12) do
|
= columns(medium: 12) do
|
||||||
%p= _'error.404.description', :p
|
- if @token_not_found.present?
|
||||||
= render 'contact', cancel_btn: false, contact_reason: :website
|
%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
|
@ -13,7 +13,6 @@
|
|||||||
- @conferences.each do | conference |
|
- @conferences.each do | conference |
|
||||||
= link_to (_!conference.title), administration_step_path(conference.slug, :edit), class: :button
|
= link_to (_!conference.title), administration_step_path(conference.slug, :edit), class: :button
|
||||||
|
|
||||||
|
|
||||||
= form_tag update_settings_path do
|
= form_tag update_settings_path do
|
||||||
= textfield :name, current_user.name, required: true, heading: 'articles.conference_registration.headings.name', big: true
|
= 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'
|
= 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
|
= button_tag :save, value: :save
|
||||||
- else
|
- else
|
||||||
%h2=_'forms.actions.generic.login'
|
%h2=_'forms.actions.generic.login'
|
||||||
= form_tag do_confirm_path, class: 'flex-form' do
|
= render 'login'
|
||||||
= 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]
|
|
@ -5787,6 +5787,7 @@ en:
|
|||||||
'404':
|
'404':
|
||||||
description: The page you are looking for could not be found. If you think this was in error, please contact us.
|
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'
|
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:
|
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!
|
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'
|
title: '404: %{language} Translations Missing'
|
||||||
|
@ -1107,6 +1107,7 @@ es:
|
|||||||
'404':
|
'404':
|
||||||
title: '404: Esta página no existe'
|
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.
|
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':
|
'403':
|
||||||
title: Lo sentimos. Por el momento no tienes acceso a esta página
|
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.
|
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.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user