Fixed facbook login and added missing page titiles
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
Reference in New Issue
Block a user