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
|
# File 'app/facebookoauth_controller.rb', line 10
def callback
conf_data = Fboauth2::Newfbclient.get_conf_data
if !conf_data[params[:config]].nil? && conf_data[params[:config]] != "" && !params[:code].nil? && params[:code] != ""
client = Fboauth2::Newfbclient.auth_callback(params[:code], Fboauth2::Newfbclient.get_url(request.env["HTTP_HOST"], params[:config]))
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_redirect_path(params)
else
puts "**** Fboauth2 ERROR: config parameter is required or fbuser not allow permission to app****"
redirect_to "/"
end
end
|