Fixed Facebook login for ES and added email error reporting for prod.
This commit is contained in:
parent
7a7bb7b579
commit
cf1345c211
@ -1179,6 +1179,11 @@ $header-tilt: 8deg;
|
|||||||
.secondary {
|
.secondary {
|
||||||
font-size: 1.5em;
|
font-size: 1.5em;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
body.error-500 & {
|
||||||
|
background-position: 50% 50%;
|
||||||
|
background-color: $colour-2;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#footer {
|
#footer {
|
||||||
|
@ -102,6 +102,10 @@ table {
|
|||||||
td {
|
td {
|
||||||
border-collapse: collapse;
|
border-collapse: collapse;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
th {
|
||||||
|
text-align: left;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
table#bb_full_width,
|
table#bb_full_width,
|
||||||
|
@ -92,12 +92,22 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
|
|
||||||
def do_403(template = nil)
|
def do_403(template = nil)
|
||||||
@template = template
|
@template = template
|
||||||
|
@page_title ||= 'page_titles.403.Access_Denied'
|
||||||
@main_title ||= @page_title
|
@main_title ||= @page_title
|
||||||
params[:_original_action] = params[:action]
|
params[:_original_action] = params[:action]
|
||||||
params[:action] = 'error-403'
|
params[:action] = 'error-403'
|
||||||
render 'application/permission_denied', status: 403
|
render 'application/permission_denied', status: 403
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def error_500(exception)
|
||||||
|
|
||||||
|
@page_title = 'page_titles.500.An_Error_Occurred'
|
||||||
|
@main_title = 'error.500.title'
|
||||||
|
params[:_original_action] = params[:action]
|
||||||
|
params[:action] = 'error-500'
|
||||||
|
render 'application/500', status: 500
|
||||||
|
end
|
||||||
|
|
||||||
rescue_from ActiveRecord::RecordNotFound do |exception|
|
rescue_from ActiveRecord::RecordNotFound do |exception|
|
||||||
do_404
|
do_404
|
||||||
end
|
end
|
||||||
@ -119,6 +129,22 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
rescue_from StandardError do |exception|
|
||||||
|
# send and email if this is production
|
||||||
|
UserMailer.error_report(
|
||||||
|
"An error has occurred in #{Rails.env}",
|
||||||
|
nil,
|
||||||
|
exception.to_s,
|
||||||
|
exception,
|
||||||
|
request,
|
||||||
|
params,
|
||||||
|
current_user,
|
||||||
|
).deliver_now if Rails.env.preview? || Rails.env.production?
|
||||||
|
|
||||||
|
# show the error page
|
||||||
|
error_500 exception
|
||||||
|
end
|
||||||
|
|
||||||
def generate_confirmation(user, url, expiry = nil)
|
def generate_confirmation(user, url, expiry = nil)
|
||||||
if user.is_a? String
|
if user.is_a? String
|
||||||
user = User.find_by_email(user)
|
user = User.find_by_email(user)
|
||||||
@ -128,8 +154,6 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
end
|
end
|
||||||
expiry ||= (Time.now + 12.hours)
|
expiry ||= (Time.now + 12.hours)
|
||||||
session[:confirm_uid] = user.id
|
session[:confirm_uid] = user.id
|
||||||
#confirmation = EmailConfirmation.create(user_id: user.id, expiry: expiry, url: url)
|
|
||||||
#UserMailer.email_confirmation(confirmation).deliver_now
|
|
||||||
UserMailer.send_mail :email_confirmation do
|
UserMailer.send_mail :email_confirmation do
|
||||||
{
|
{
|
||||||
:args => EmailConfirmation.create(user_id: user.id, expiry: expiry, url: url)
|
:args => EmailConfirmation.create(user_id: user.id, expiry: expiry, url: url)
|
||||||
@ -247,4 +271,17 @@ class ApplicationController < LinguaFrancaApplicationController
|
|||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def i18n_exception(str, exception, locale, key)
|
||||||
|
# send and email if this is production
|
||||||
|
UserMailer.error_report(
|
||||||
|
"A missing translation found in #{Rails.env}",
|
||||||
|
"A translation for #{key} in #{locale.to_s} was found. The text that was rendered to the user was \"#{str || 'nil'}\".",
|
||||||
|
exception.to_s,
|
||||||
|
exception,
|
||||||
|
request,
|
||||||
|
params,
|
||||||
|
current_user,
|
||||||
|
).deliver_now if Rails.env.preview? || Rails.env.production?
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -33,8 +33,12 @@ class OauthsController < ApplicationController
|
|||||||
end
|
end
|
||||||
|
|
||||||
def set_callback
|
def set_callback
|
||||||
|
# force https for prod
|
||||||
|
protocol = Rails.env.preview? || Rails.env.production? ? 'https://' : request.protocol
|
||||||
|
|
||||||
|
# build the callback url
|
||||||
Sorcery::Controller::Config.send(params[:provider]).callback_url =
|
Sorcery::Controller::Config.send(params[:provider]).callback_url =
|
||||||
"#{request.protocol}#{request.env['HTTP_HOST']}/oauth/callback?provider=facebook"
|
"#{protocol}#{request.env['HTTP_HOST']}/oauth/callback?provider=facebook"
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
@ -164,4 +164,15 @@ class UserMailer < ActionMailer::Base
|
|||||||
mail to: user.email, subject: @subject
|
mail to: user.email, subject: @subject
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def error_report(subject, message, report, exception, request, params, user)
|
||||||
|
@host = UserMailer.default_url_options[:host]
|
||||||
|
@subject = subject
|
||||||
|
@message = message
|
||||||
|
@report = report
|
||||||
|
@exception = exception
|
||||||
|
@request = request
|
||||||
|
@params = params
|
||||||
|
@user = user
|
||||||
|
mail to: 'goodgodwin@hotmail.com', subject: @subject
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
@ -5,5 +5,5 @@
|
|||||||
- else
|
- else
|
||||||
= row do
|
= row do
|
||||||
= columns do
|
= columns do
|
||||||
%h2=_'articles.permission_denied.headings.main','Sorry, you currently don\'t have access to this page'
|
%h2=_'error.403.title','Sorry, you currently don\'t have access to this page'
|
||||||
%p=_'articles.permission_denied.paragraphs.main', :p
|
%p=_'error.403.description', :p
|
||||||
|
@ -5601,6 +5601,7 @@ en:
|
|||||||
facebook_sign_in: Facebook Sign In
|
facebook_sign_in: Facebook Sign In
|
||||||
page_titles:
|
page_titles:
|
||||||
'403':
|
'403':
|
||||||
|
Access_Denied: Access Denied
|
||||||
Please_Confirm_Email: Please confirm your email
|
Please_Confirm_Email: Please confirm your email
|
||||||
Please_Check_Email: Please check your email
|
Please_Check_Email: Please check your email
|
||||||
Please_Login: Please login
|
Please_Login: Please login
|
||||||
@ -5628,6 +5629,8 @@ en:
|
|||||||
About: 'About'
|
About: 'About'
|
||||||
Register: 'Register'
|
Register: 'Register'
|
||||||
Pre_Register: 'Pre-Register'
|
Pre_Register: 'Pre-Register'
|
||||||
|
'500':
|
||||||
|
An_Error_Occurred: An Error Occurred
|
||||||
links:
|
links:
|
||||||
footer:
|
footer:
|
||||||
help_text:
|
help_text:
|
||||||
@ -5667,11 +5670,17 @@ en:
|
|||||||
conference:
|
conference:
|
||||||
Translate: Edit %{language} version
|
Translate: Edit %{language} version
|
||||||
error:
|
error:
|
||||||
|
'403':
|
||||||
|
description: You do not currently have sufficient permissions to access this page. If you believe this is an error, please contact us or file an issue.
|
||||||
|
title: You do not have access to this page
|
||||||
'404':
|
'404':
|
||||||
description: Sorry, we couldn't find the page you were looking for. If you really
|
description: Sorry, we couldn't find the page you were looking for. If you really
|
||||||
believe that it should exist please contact admin@bikebike.org or file an
|
believe that it should exist please contact admin@bikebike.org or file an
|
||||||
issue on github: https://github.com/bikebike/BikeBike/issues
|
issue on github: https://github.com/bikebike/BikeBike/issues
|
||||||
title: '404: This page doesn''t exist'
|
title: '404: This page doesn''t exist'
|
||||||
|
'500':
|
||||||
|
title: There is a problem
|
||||||
|
description: 'An error has occurred, details about the error have been sent to our development team. In addition, you may contact us or report an issue.'
|
||||||
roles:
|
roles:
|
||||||
workshops:
|
workshops:
|
||||||
facilitator:
|
facilitator:
|
||||||
|
@ -50,7 +50,9 @@ BikeBike::Application.routes.draw do
|
|||||||
get '/oauth/:provider' => 'oauths#oauth', :as => :auth_at_provider
|
get '/oauth/:provider' => 'oauths#oauth', :as => :auth_at_provider
|
||||||
post '/translator-request' => 'application#translator_request', :as => :translator_request
|
post '/translator-request' => 'application#translator_request', :as => :translator_request
|
||||||
|
|
||||||
|
get '/error_403' => 'application#do_403'
|
||||||
get '/error_404' => 'application#error_404'
|
get '/error_404' => 'application#error_404'
|
||||||
|
get '/error_500' => 'application#error_500'
|
||||||
get '/404' => 'application#error_404'
|
get '/404' => 'application#error_404'
|
||||||
get '/about' => 'application#about', :as => :about
|
get '/about' => 'application#about', :as => :about
|
||||||
get '/policy' => 'application#policy', :as => :policy
|
get '/policy' => 'application#policy', :as => :policy
|
||||||
|
Loading…
x
Reference in New Issue
Block a user