multiauth 0.0.3 → 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.3
1
+ 0.1.0
@@ -9,21 +9,21 @@
9
9
  <div id="slides">
10
10
  <ul class="list">
11
11
  <% count = 0 %>
12
- <% Multiauth::PROVIDERS.each_slice(6) do |providers| %>
12
+ <% multiauth_providers.each_slice(6) do |providers| %>
13
13
  <li class="page">
14
14
  <% providers.each_slice(3) do |column| %>
15
15
  <div class="column">
16
- <% column.each do |provider| %>
17
- <a id="btn_<%= count+=1 %>" class="<%= provider[:name] %> openid_btn" title="<%= provider[:name] %>" href="<%= provider[:url] %>" data-real="<%= provider[:real] || false %>"></a>
16
+ <% column.each do |provider, config| %>
17
+ <a id="btn_<%= count+=1 %>" class="<%= provider %> openid_btn <%= config[:class] %>" title="<%= provider %>" href="<%= config[:url].kind_of?(Proc) ? instance_exec(&config[:url]) : config[:url] %>" data-real="<%= config[:real] || false %>"></a>
18
18
  <% end %>
19
19
  </div>
20
20
  <% end %>
21
21
  </li>
22
22
  <% end %>
23
23
  </ul>
24
- <div class="clear"></div>
25
24
  </div>
26
25
  </div>
26
+ <div class="clear"></div>
27
27
  </div>
28
28
  <div id="openid_inputarea">
29
29
  <span class="oidlabel">username</span>
@@ -90,4 +90,11 @@ Some setup you must do manually if you haven't yet:
90
90
 
91
91
  3. configure your twitter, facebook and github keys
92
92
 
93
+ You can config providers in an initializer, for example:
94
+
95
+ Multiauth::PROVIDERS.delete("Vidoop")
96
+ Multiauth::PROVIDERS.delete("Github")
97
+ Multiauth::PROVIDERS["Google"][:class] = "selected"
98
+
99
+
93
100
  ===============================================================================
@@ -13,6 +13,19 @@ module Multiauth
13
13
  javascript_include_tag('multiauth')+
14
14
  stylesheet_link_tag('multiauth')
15
15
  end
16
+
17
+ def multiauth_providers
18
+ providers = Multiauth::PROVIDERS
19
+ if !devise_mapping.oauthable?
20
+ providers.delete("Facebook")
21
+ providers.delete("Github")
22
+ else
23
+ providers.delete("Facebook") if !resource_class.oauth_providers.include?(:facebook)
24
+ providers.delete("Github") if !resource_class.oauth_providers.include?(:github)
25
+ end
26
+
27
+ providers
28
+ end
16
29
  end
17
30
  end
18
31
 
data/lib/multiauth.rb CHANGED
@@ -2,82 +2,64 @@ require 'multiauth/rails'
2
2
  require 'multiauth/views_helper'
3
3
 
4
4
  module Multiauth
5
- PROVIDERS = [
6
- {
7
- :name => 'Google',
5
+ PROVIDERS = {
6
+ 'Google' => {
8
7
  :url => 'https://www.google.com/accounts/o8/id'
9
8
  },
10
- {
11
- :name => 'Yahoo',
9
+ 'Yahoo' => {
12
10
  :url => 'http://yahoo.com/'
13
11
  },
14
- {
15
- :name => 'Twitter',
12
+ 'Twitter' => {
16
13
  :url => '/users/sign_in/twitter',
17
14
  :real => true
18
15
  },
19
- {
20
- :name => 'Facebook',
21
- :selector => '#facebook_signin', # FIXME
16
+ 'Facebook' => {
17
+ :selector => lambda { oauth_authorize_url(resource_name, :facebook) },
22
18
  :real => true
23
19
  },
24
- {
25
- :name => 'Launchpad',
20
+ 'Launchpad' => {
26
21
  :url => 'https://launchpad.net/~{user_name}'
27
22
  },
28
- {
29
- :name => 'Github',
30
- :url => '#github_signin', # FIXME
23
+ 'Github' => {
24
+ :url => lambda { oauth_authorize_url(resource_name, :github) },
31
25
  :real => true
32
26
  },
33
- {
34
- :name => 'AOL',
27
+ 'AOL' => {
35
28
  :user_name_txt => 'screen:name',
36
29
  :url => 'http://openid.aol.com/{user_name}'
37
30
  },
38
- {
39
- :name => 'OpenID',
40
- :user_name_txt => ':url'
31
+ 'OpenID' => {
32
+ :url => '{user_name}'
41
33
  },
42
- {
43
- :name => 'MyOpenID',
34
+ 'MyOpenID' => {
44
35
  :url => 'http://{user_name}.myopenid.com/'
45
36
  },
46
- {
47
- :name => 'Flickr',
37
+ 'Flickr' => {
48
38
  :url => 'http://flickr.com/{user_name}/'
49
39
  },
50
- {
51
- :name => 'Vidoop',
40
+ 'Vidoop' => {
52
41
  :url => 'http://{user_name}.myvidoop.com/'
53
42
  },
54
- {
55
- :name => 'ClaimID',
43
+ 'ClaimID' => {
56
44
  :url => 'http://claimid.com/{user_name}'
57
45
  },
58
- {
59
- :name => 'Technorati',
46
+ 'Technorati' => {
60
47
  :url => 'http://technorati.com/people/technorati/{user_name}/'
61
48
  },
62
- {
63
- :name => 'Wordpress',
49
+ 'Wordpress' => {
64
50
  :url => 'http://{user_name}.wordpress.com/'
65
51
  },
66
- {
67
- :name => 'Blogger',
52
+ 'Blogger' => {
68
53
  :url => 'http://{user_name}.blogspot.com/'
69
54
  },
70
- {
71
- :name => 'Verisign',
55
+ 'Verisign' => {
72
56
  :url => 'http://{user_name}.pip.verisignlabs.com/'
73
57
  },
74
- {
75
- :name => 'LiveJournal',
58
+ 'LiveJournal' => {
76
59
  :url => 'http://{user_name}.livejournal.com'
77
60
  },
78
- {
79
- :name => 'MySpace',
61
+ 'MySpace' => {
80
62
  :url => 'http://www.myspace.com/{user_name}'
81
63
  }
82
- ]
64
+ }
83
65
  end
data/multiauth.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{multiauth}
8
- s.version = "0.0.3"
8
+ s.version = "0.1.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["David A. Cuadrado"]
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
+ - 1
7
8
  - 0
8
- - 3
9
- version: 0.0.3
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - David A. Cuadrado