devise-browserid 0.5.2 → 0.5.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/.travis.yml +3 -0
- data/README.md +5 -6
- data/Rakefile +4 -0
- data/devise-browserid.gemspec +1 -2
- data/lib/devise-browserid/version.rb +1 -1
- data/lib/devise-browserid/view_helpers.rb +2 -2
- data/vendor/assets/javascripts/browserid.js +4 -25
- metadata +35 -8
data/.travis.yml
ADDED
data/README.md
CHANGED
@@ -21,15 +21,13 @@ Or install it yourself as:
|
|
21
21
|
devise-browserid depends on warden-browserid and is enabled in the Rails
|
22
22
|
asset pipeline.
|
23
23
|
|
24
|
-
I use the devise-browserid strategy with warden
|
25
|
-
config/initializers/devise.rb
|
24
|
+
I use the devise-browserid strategy with warden. [Mozilla] [1] says to use
|
25
|
+
BrowserID as shown. In your Rails config/initializers/devise.rb:
|
26
26
|
|
27
27
|
```ruby
|
28
28
|
config.warden do |manager|
|
29
29
|
manager.default_strategies(:scope => :user).unshift :browserid
|
30
|
-
#
|
31
|
-
# manager.browserid_url = "dev.diresworb.org" # Development
|
32
|
-
(default)
|
30
|
+
# manager.browserid_url = "dev.diresworb.org" # Development (default)
|
33
31
|
# manager.browserid_url = "diresworb.org" # Beta
|
34
32
|
# manager.browserid_url = "browserid.org" # Production
|
35
33
|
end
|
@@ -42,7 +40,8 @@ Then you add the javascripts at the bottom of your application layout:
|
|
42
40
|
|
43
41
|
And the login button wherever you want to:
|
44
42
|
```erb
|
45
|
-
|
43
|
+
<% sign_in_path = "/sign_in" %>
|
44
|
+
<%= browserid_login_tag(sign_in_path) %>
|
46
45
|
```
|
47
46
|
|
48
47
|
[1]: https://developer.mozilla.org/en/BrowserID/Primary/Developer_tips
|
data/Rakefile
CHANGED
data/devise-browserid.gemspec
CHANGED
@@ -11,8 +11,6 @@ Gem::Specification.new do |s|
|
|
11
11
|
s.description = %q{BrowserID helpers for Devise}
|
12
12
|
s.summary = %q{Authenticate your Devise/Warden-enabled Rails app using BrowserID from Mozilla}
|
13
13
|
|
14
|
-
s.rubyforge_project = "devise-browserid"
|
15
|
-
|
16
14
|
s.files = `git ls-files`.split("\n")
|
17
15
|
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
16
|
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
@@ -20,4 +18,5 @@ Gem::Specification.new do |s|
|
|
20
18
|
|
21
19
|
s.add_dependency "warden-browserid", ">= 0.8.0"
|
22
20
|
s.add_dependency "devise"
|
21
|
+
s.add_dependency "rake"
|
23
22
|
end
|
@@ -9,8 +9,8 @@ module BrowserId
|
|
9
9
|
end
|
10
10
|
|
11
11
|
# The BrowserID login button
|
12
|
-
def browserid_login_tag
|
13
|
-
image_tag("sign_in_blue.png", :onclick => "browserIdLogin();")
|
12
|
+
def browserid_login_tag(path)
|
13
|
+
image_tag("sign_in_blue.png", :onclick => "browserIdLogin('#{path}');")
|
14
14
|
end
|
15
15
|
|
16
16
|
# The URL to the BrowserID official JavaScript
|
@@ -1,41 +1,20 @@
|
|
1
|
-
/*
|
2
|
-
* BrowserID API function: https://developer.mozilla.org/en/BrowserID/Quick_Setup
|
3
|
-
*/
|
4
|
-
function gotAssertion(assertion) {
|
5
|
-
// got an assertion, now send it up to the server for verification
|
6
|
-
if (assertion !== null) {
|
7
|
-
$.ajax({
|
8
|
-
type: 'POST',
|
9
|
-
url: '/d/users/sign_in',
|
10
|
-
data: { assertion: assertion },
|
11
|
-
success: function(res, status, xhr) {
|
12
|
-
if (res === null) {}//loggedOut();
|
13
|
-
else alert(res);
|
14
|
-
},
|
15
|
-
error: function(res, status, xhr) {
|
16
|
-
console.log("login failure" + res);
|
17
|
-
}
|
18
|
-
});
|
19
|
-
} else {
|
20
|
-
//loggedOut();
|
21
|
-
}
|
22
|
-
}
|
23
|
-
|
24
1
|
/*
|
25
2
|
* Our BrowserID login call. If the assertion was found, send this to Devise
|
26
3
|
* with warden-browserid enabled for verification and login.
|
27
4
|
*/
|
28
|
-
function browserIdLogin() {
|
5
|
+
function browserIdLogin(sign_in_path) {
|
29
6
|
navigator.id.get(function(assertion) {
|
30
7
|
if (assertion) {
|
31
8
|
// This code will be invoked once the user has successfully
|
32
9
|
// selected an email address they control to sign in with.
|
33
10
|
$.ajax({
|
34
|
-
url:
|
11
|
+
url: sign_in_path,
|
35
12
|
type: "POST",
|
36
13
|
data: {"assertion": assertion},
|
14
|
+
dataTYpe: "json",
|
37
15
|
cache:false,
|
38
16
|
success:function(data,status){
|
17
|
+
console.log(data);
|
39
18
|
window.location.href = '/';
|
40
19
|
},
|
41
20
|
error:function(data,status){
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: devise-browserid
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-04-
|
12
|
+
date: 2012-04-27 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: warden-browserid
|
16
|
-
requirement:
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,15 @@ dependencies:
|
|
21
21
|
version: 0.8.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements:
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.0
|
25
30
|
- !ruby/object:Gem::Dependency
|
26
31
|
name: devise
|
27
|
-
requirement:
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
28
33
|
none: false
|
29
34
|
requirements:
|
30
35
|
- - ! '>='
|
@@ -32,7 +37,28 @@ dependencies:
|
|
32
37
|
version: '0'
|
33
38
|
type: :runtime
|
34
39
|
prerelease: false
|
35
|
-
version_requirements:
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: '0'
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: rake
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '0'
|
54
|
+
type: :runtime
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
36
62
|
description: BrowserID helpers for Devise
|
37
63
|
email:
|
38
64
|
- runar@rin.no
|
@@ -41,6 +67,7 @@ extensions: []
|
|
41
67
|
extra_rdoc_files: []
|
42
68
|
files:
|
43
69
|
- .gitignore
|
70
|
+
- .travis.yml
|
44
71
|
- Gemfile
|
45
72
|
- README.md
|
46
73
|
- Rakefile
|
@@ -75,8 +102,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
75
102
|
- !ruby/object:Gem::Version
|
76
103
|
version: '0'
|
77
104
|
requirements: []
|
78
|
-
rubyforge_project:
|
79
|
-
rubygems_version: 1.8.
|
105
|
+
rubyforge_project:
|
106
|
+
rubygems_version: 1.8.23
|
80
107
|
signing_key:
|
81
108
|
specification_version: 3
|
82
109
|
summary: Authenticate your Devise/Warden-enabled Rails app using BrowserID from Mozilla
|