Fixed facbook login and added missing page titiles

This commit is contained in:
Godwin
2016-06-01 17:15:02 -07:00
parent 9ae5da70fb
commit 844fe3d467
9 changed files with 34 additions and 36 deletions
+3
View File
@@ -21,6 +21,7 @@ body {
margin: 0;
padding: 0;
width: 100% !important;
max-width: 100% !important;
line-height: 100% !important;
}
@@ -70,6 +71,8 @@ a {
p {
margin: 1em;
color: $black !important;
font-size: 1.5em;
line-height: 1.3333em;
}
h1, h2, h3, h4, h5, h6 {
+8 -5
View File
@@ -79,17 +79,20 @@ class ApplicationController < LinguaFrancaApplicationController
end
def do_404
params[:_original_action] = params[:action]
params[:action] = 'error-404'
render 'application/404', status: 404
error_404(status: 404)
end
def error_404
render 'application/404'
def error_404(args = {})
params[:_original_action] = params[:action]
params[:action] = 'error-404'
@page_title = 'page_titles.404.Page_Not_Found'
@main_title = 'error.404.title'
render 'application/404', args
end
def do_403(template = nil)
@template = template
@main_title ||= @page_title
params[:_original_action] = params[:action]
params[:action] = 'error-403'
render 'application/permission_denied', status: 403
+3 -3
View File
@@ -529,13 +529,13 @@ class ConferencesController < ApplicationController
@name ||= current_user.username
@is_host = @this_conference.host? current_user
steps = registration_steps
return do_404 unless steps.present?
else
@register_template = :confirm_email
end
steps = registration_steps
return do_404 unless steps.present?
@errors = {}
@warnings = []
form_step = params[:button] ? params[:button].to_sym : nil
+8 -13
View File
@@ -4,11 +4,14 @@ class OauthsController < ApplicationController
# sends the user on a trip to the provider,
# and after authorizing there back to the callback url.
def oauth
set_callback
session[:oauth_last_url] = request.referer
login_at(auth_params[:provider])
end
def callback
set_callback
user_info = (sorcery_fetch_user_hash auth_params[:provider] || {})[:user_info]
user = User.find_by_email(user_info['email'])
@@ -22,19 +25,6 @@ class OauthsController < ApplicationController
auto_login(user) if user
redirect_to (session[:oauth_last_url] || home_path)
#, :notice => "Logged in with #{provider.titleize}!"
# if @user = login_from(provider)
# else
# begin
# @user = create_from(auth_params[:provider])
# reset_session
# auto_login(@user)
# redirect_to redirect_url, :notice => "Signed up with #{provider.titleize}!"
# rescue
# redirect_to redirect_url, :alert => "Failed to login with #{provider.titleize}!"
# end
# end
end
private
@@ -42,4 +32,9 @@ class OauthsController < ApplicationController
params.permit(:code, :provider)
end
def set_callback
Sorcery::Controller::Config.send(params[:provider]).callback_url =
"#{request.protocol}#{request.env['HTTP_HOST']}/oauth/callback?provider=facebook"
end
end
+2 -1
View File
@@ -54,7 +54,8 @@ class Conference < ActiveRecord::Base
end
def registration_status
read_attribute(:registration_status).to_sym
s = read_attribute(:registration_status)
s.present? ? s.to_sym : nil
end
def registration_status=(new_registration_status)
+1 -5
View File
@@ -1,8 +1,4 @@
- @page_title = 'page_titles.404.Page_Not_Found' unless @page_title.present?
= render :partial => 'application/header', :locals => {:image_file => nil}
= row do
= columns(medium: 12) do
%h1
=_'error.404.title','This page does not exist!'
=paragraph(_'error.404.description', :p)
= paragraph(_'error.404.description', :p)
+1 -1
View File
@@ -15,4 +15,4 @@
=@page_title.present? ? I18n.t(@page_title, @page_title_vars) : I18n.t("page_titles.#{page_group.to_s}.#{page_key.to_s}")
= row do
= columns do
%h1=(_"page_titles.#{page_group.to_s}.#{page_key.to_s}")
%h1=_(@main_title || "page_titles.#{page_group.to_s}.#{page_key.to_s}")