aavkontakte-rails3 0.1.8 → 0.1.9
Sign up to get free protection for your applications and to get access to all the features.
- data/VERSION +1 -1
- data/aavkontakte-rails3.gemspec +2 -2
- data/lib/vkontakte/auth_success.rb +3 -3
- data/lib/vkontakte/session.rb +2 -15
- metadata +3 -3
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.9
|
data/aavkontakte-rails3.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = "aavkontakte-rails3"
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.9"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["blimp666"]
|
12
|
-
s.date = "2013-
|
12
|
+
s.date = "2013-09-17"
|
13
13
|
s.description = "Vkontakte authorization for authlogic with ruby 1.9 and rails 3.0"
|
14
14
|
s.email = "nowhere@gmail.com"
|
15
15
|
s.extra_rdoc_files = [
|
@@ -1,12 +1,12 @@
|
|
1
1
|
module VkontakteAuthentication
|
2
|
-
|
2
|
+
|
3
3
|
def self.auth_success?(vk_app_password, cookie, request_mid)
|
4
4
|
auth_data = CGI::parse(cookie)
|
5
5
|
auth_data.update(auth_data){|key| auth_data[key][0]}
|
6
6
|
result = "expire=%smid=%ssecret=%ssid=%s%s" % [ auth_data['expire'], auth_data['mid'], auth_data['secret'], auth_data['sid'], vk_app_password]
|
7
7
|
Digest::MD5.hexdigest(result).to_s == auth_data['sig'].to_s and
|
8
|
-
request_mid.to_i == auth_data['mid'].to_i
|
8
|
+
(request_mid.nil? or request_mid.to_i == auth_data['mid'].to_i)
|
9
9
|
end
|
10
10
|
|
11
|
-
|
11
|
+
|
12
12
|
end
|
data/lib/vkontakte/session.rb
CHANGED
@@ -25,30 +25,17 @@ module VkontakteAuthentication
|
|
25
25
|
record_class.vkontakte_enabled_value && controller.cookies[record_class.vk_app_cookie].present?
|
26
26
|
end
|
27
27
|
|
28
|
-
|
29
28
|
def validate_by_vk_cookie
|
30
|
-
# p '0. AA_VK DEBUG'
|
31
|
-
# p '1. controller.params'
|
32
|
-
# p "2. #{controller.params}"
|
33
29
|
@vkontakte_data = controller.params[:user_session] if controller.params and controller.params[:user_session]
|
34
|
-
|
35
|
-
# p "4. #{@vkontakte_data}"
|
36
|
-
# p '5. controller.cookies'
|
37
|
-
# p "6. #{controller.cookies}"
|
38
|
-
# p '7. record_class.vk_app_cookie'
|
39
|
-
# p "8. #{record_class.vk_app_cookie}"
|
40
|
-
# p '9. controller.cookies[record_class.vk_app_cookie]'
|
41
|
-
# p "10. #{controller.cookies[record_class.vk_app_cookie]}"
|
30
|
+
vk_mid = @vkontakte_data ? @vkontakte_data[:mid] : nil
|
42
31
|
if VkontakteAuthentication.auth_success?(record_class.vk_app_password,
|
43
32
|
controller.cookies[record_class.vk_app_cookie],
|
44
|
-
|
33
|
+
vk_mid)
|
45
34
|
raise(NotInitializedError, "You must define vk_id column in your User model") unless record_class.attribute_names.include?(vk_id_field.to_s)
|
46
35
|
if @vkontakte_data
|
47
36
|
self.attempted_record = klass.where(vk_id_field => @vkontakte_data[:mid].to_i).first
|
48
|
-
# p self.attempted_record
|
49
37
|
# self.attempted_record = $current_session.user if self.attempted_record.blank? and $current_session
|
50
38
|
self.attempted_record = controller.saved_current_session.user if self.attempted_record.blank? and controller.saved_current_session
|
51
|
-
# p $current_session
|
52
39
|
if self.attempted_record.blank?
|
53
40
|
# creating a new account
|
54
41
|
self.new_registration = true
|
metadata
CHANGED
@@ -2,14 +2,14 @@
|
|
2
2
|
name: aavkontakte-rails3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.1.
|
5
|
+
version: 0.1.9
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- blimp666
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-
|
12
|
+
date: 2013-09-17 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -125,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
125
125
|
requirements:
|
126
126
|
- - ! '>='
|
127
127
|
- !ruby/object:Gem::Version
|
128
|
-
hash:
|
128
|
+
hash: -1182890428541316810
|
129
129
|
segments:
|
130
130
|
- 0
|
131
131
|
version: '0'
|