2015-03-19 22:37:16 +01:00
|
|
|
class CallbacksController < Devise::OmniauthCallbacksController
|
|
|
|
def zeuswpi
|
|
|
|
@user = User.from_omniauth(request.env["omniauth.auth"])
|
2015-03-20 03:57:00 +01:00
|
|
|
@user.save!(validate: false)
|
|
|
|
if @user.valid?
|
|
|
|
flash[:success] = "You are now logged in."
|
|
|
|
sign_in_and_redirect @user
|
|
|
|
else
|
|
|
|
flash[:error] = "Please complete your profile first."
|
|
|
|
session[:id] = @user.id
|
|
|
|
redirect_to new_user_avatar_path
|
|
|
|
end
|
2015-03-19 22:37:16 +01:00
|
|
|
end
|
2015-03-20 02:21:56 +01:00
|
|
|
|
|
|
|
def after_omniauth_failure_path_for(scope)
|
|
|
|
root_path
|
|
|
|
end
|
2015-03-19 22:37:16 +01:00
|
|
|
end
|