10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controller/facebookoauth_controller.rb', line 10
def callback
conf_data = Fboauth2::Newfbclient.get_conf_data
if !conf_data[params[:config]].nil? && conf_data[params[:config]] != ""
if !params[:code].nil? && params[:code] != ""
client = Fboauth2::Newfbclient.auth_callback(params[:code], Fboauth2::Newfbclient.get_url(request.env["HTTP_HOST"]))
fb_user = client.selection.me.info!
if conf_data[params[:config]]["hmodel"] == "t"
Fboauth2::Newfbclient.crate_new_m(conf_data, params, fb_user)
end
if conf_data[params[:config]]["hfbmsg"] == "t"
Fboauth2::Newfbclient.send_fb_msg(params[:config], fb_user)
end
redirect_to Fboauth2::Newfbclient.get_path('redirect', params)
else
puts "-"*50
puts "**** Fboauth2 ERROR: Facebook User not allow permission to app****"
puts "-"*50
redirect_to Fboauth2::Newfbclient.get_path('notallow', params)
end
else
puts "-"*50
puts "**** Fboauth2 ERROR: config parameter is required ****"
puts "-"*50
redirect_to "/"
end
end
|