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 | ||||
| 
 | ||||
| 	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) | ||||
|  | ||||
| @ -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 | ||||
|  | ||||
| @ -1,5 +1,9 @@ | ||||
| = render :partial => 'application/header', :locals => {:image_file => nil} | ||||
| = row do | ||||
| 	= columns(medium: 12) do | ||||
| 		- 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 | ||||
| @ -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' | ||||
| @ -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' | ||||
|  | ||||
| @ -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. | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user