oa-vkontakte 0.2.0 → 0.2.1

Sign up to get free protection for your applications and to get access to all the features.
data/README.rdoc CHANGED
@@ -20,6 +20,10 @@
20
20
 
21
21
  <%= vkontakte_login_button %>
22
22
 
23
+ Если хотите свою красивую картинку вместо дефолтной вконтактовской кнопки, делайте так:
24
+
25
+ <%= vkontakte_login_button(link_to_function( image_tag("/path/to/image"), "vkLogin.doLogin()" )) %>
26
+
23
27
  Также кнопка доступна по адресу /auth/vkontakte, но форма там передается GET-запросом. Можно пропробовать встроить её как iframe.
24
28
 
25
29
  После клика на кнопку и разрешения добавления приложения, будет совершен POST-запрос на /auth/vkontakte/callback.
@@ -75,4 +79,4 @@ OmniAuth: http://github.com/intridea/omniauth
75
79
 
76
80
  == Copyright
77
81
 
78
- Copyright (c) 2010 Nick Recobra. See LICENSE for details.
82
+ Copyright (c) 2010-2011 Nick Recobra. See LICENSE for details.
@@ -1,5 +1,5 @@
1
1
  module Oa
2
2
  module Vkontakte
3
- VERSION = "0.2.0"
3
+ VERSION = "0.2.1"
4
4
  end
5
5
  end
@@ -22,16 +22,21 @@ module OmniAuth
22
22
  HEADER
23
23
  end
24
24
 
25
- def vkontakte_login_button
26
- <<-BUTTON
27
- <div id="vk_api_transport"></div>
25
+ def vkontakte_login_button control = nil
26
+ default_control = false
27
+ control ||= begin
28
+ default_control = true
29
+ '<div id="vk_login" onclick="vkLogin.doLogin();"></div>'
30
+ end
31
+ button= <<-BUTTON
32
+ <div id="vk_api_transport" style="float:left"></div>
28
33
  <script type="text/javascript">
29
34
  window.vkAsyncInit = function() {
30
35
  VK.init({
31
36
  apiId: '#{OmniAuth.config.vkontakte_app_id}',
32
37
  nameTransportPath: "/xd_receiver.html"
33
38
  });
34
- VK.UI.button('vk_login');
39
+ #{ "VK.UI.button('vk_login');" if default_control }
35
40
  };
36
41
  vkLogin = {
37
42
  doLogin: function() {
@@ -114,8 +119,9 @@ HEADER
114
119
  document.getElementById("vk_api_transport").appendChild(el);
115
120
  }());
116
121
  </script>
117
- <div id="vk_login" onclick="vkLogin.doLogin();"></div>
122
+ #{ control }
118
123
  BUTTON
124
+ button.respond_to?(:html_safe) ? button.html_safe : button
119
125
  end
120
126
 
121
127
  def vkontakte_footer
@@ -34,8 +34,6 @@ module OmniAuth
34
34
  sig_index = args.index { |arg| arg =~ /^sig=/ }
35
35
  return fail!(:invalid_credentials) unless sig_index
36
36
  sig = args.delete_at(sig_index)
37
- puts Digest::MD5.new.hexdigest(args.sort.join('') + OmniAuth.config.vkontakte_app_key)
38
- puts sig
39
37
  return fail!(:invalid_credentials) unless Digest::MD5.new.hexdigest(args.sort.join('') + OmniAuth.config.vkontakte_app_key) == sig[4..-1]
40
38
  super
41
39
  end
@@ -1,3 +1,4 @@
1
+ # encoding: utf-8
1
2
  require File.dirname(__FILE__) + '/../../spec_helper'
2
3
 
3
4
  describe OmniAuth::Strategies::Vkontakte, :type => :strategy do
metadata CHANGED
@@ -1,13 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oa-vkontakte
3
3
  version: !ruby/object:Gem::Version
4
- hash: 23
5
- prerelease: false
6
- segments:
7
- - 0
8
- - 2
9
- - 0
10
- version: 0.2.0
4
+ prerelease:
5
+ version: 0.2.1
11
6
  platform: ruby
12
7
  authors:
13
8
  - Nick Recobra
@@ -15,7 +10,7 @@ autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
12
 
18
- date: 2011-01-26 00:00:00 +03:00
13
+ date: 2011-03-06 00:00:00 +03:00
19
14
  default_executable:
20
15
  dependencies:
21
16
  - !ruby/object:Gem::Dependency
@@ -26,11 +21,6 @@ dependencies:
26
21
  requirements:
27
22
  - - ">="
28
23
  - !ruby/object:Gem::Version
29
- hash: 23
30
- segments:
31
- - 0
32
- - 1
33
- - 6
34
24
  version: 0.1.6
35
25
  type: :runtime
36
26
  version_requirements: *id001
@@ -42,11 +32,6 @@ dependencies:
42
32
  requirements:
43
33
  - - ~>
44
34
  - !ruby/object:Gem::Version
45
- hash: 11
46
- segments:
47
- - 2
48
- - 1
49
- - 0
50
35
  version: 2.1.0
51
36
  type: :development
52
37
  version_requirements: *id002
@@ -58,9 +43,6 @@ dependencies:
58
43
  requirements:
59
44
  - - ">="
60
45
  - !ruby/object:Gem::Version
61
- hash: 3
62
- segments:
63
- - 0
64
46
  version: "0"
65
47
  type: :development
66
48
  version_requirements: *id003
@@ -72,11 +54,6 @@ dependencies:
72
54
  requirements:
73
55
  - - ~>
74
56
  - !ruby/object:Gem::Version
75
- hash: 7
76
- segments:
77
- - 0
78
- - 5
79
- - 6
80
57
  version: 0.5.6
81
58
  type: :development
82
59
  version_requirements: *id004
@@ -117,23 +94,17 @@ required_ruby_version: !ruby/object:Gem::Requirement
117
94
  requirements:
118
95
  - - ">="
119
96
  - !ruby/object:Gem::Version
120
- hash: 3
121
- segments:
122
- - 0
123
97
  version: "0"
124
98
  required_rubygems_version: !ruby/object:Gem::Requirement
125
99
  none: false
126
100
  requirements:
127
101
  - - ">="
128
102
  - !ruby/object:Gem::Version
129
- hash: 3
130
- segments:
131
- - 0
132
103
  version: "0"
133
104
  requirements: []
134
105
 
135
106
  rubyforge_project: oa-vkontakte
136
- rubygems_version: 1.3.7
107
+ rubygems_version: 1.5.2
137
108
  signing_key:
138
109
  specification_version: 3
139
110
  summary: OmniAuth extension for vkontakte.ru authentication