devise-browserid 0.5.1 → 0.5.2

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/README.md CHANGED
@@ -18,7 +18,7 @@ Or install it yourself as:
18
18
 
19
19
  ## Usage
20
20
 
21
- devise-browserid depends on warden-browserid and lives in the Rails
21
+ devise-browserid depends on warden-browserid and is enabled in the Rails
22
22
  asset pipeline.
23
23
 
24
24
  I use the devise-browserid strategy with warden, configured like this in
@@ -27,7 +27,11 @@ config/initializers/devise.rb in Rails:
27
27
  ```ruby
28
28
  config.warden do |manager|
29
29
  manager.default_strategies(:scope => :user).unshift :browserid
30
- manager.browserid_url = "dev.diresworb.org"
30
+ # [Mozilla] [1] says to use BrowserID as follows:
31
+ # manager.browserid_url = "dev.diresworb.org" # Development
32
+ (default)
33
+ # manager.browserid_url = "diresworb.org" # Beta
34
+ # manager.browserid_url = "browserid.org" # Production
31
35
  end
32
36
  ```
33
37
 
@@ -41,6 +45,9 @@ And the login button wherever you want to:
41
45
  <%= browserid_login_tag %>
42
46
  ```
43
47
 
48
+ [1]: https://developer.mozilla.org/en/BrowserID/Primary/Developer_tips
49
+ "Mozilla BrowserID Developer Tips"
50
+
44
51
  ## Contributing
45
52
 
46
53
  1. Fork it
@@ -18,6 +18,6 @@ Gem::Specification.new do |s|
18
18
  s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
19
19
  s.require_paths = ["lib"]
20
20
 
21
- s.add_dependency "warden-browserid"
21
+ s.add_dependency "warden-browserid", ">= 0.8.0"
22
22
  s.add_dependency "devise"
23
23
  end
@@ -1,7 +1,7 @@
1
1
  require 'devise-browserid/view_helpers'
2
2
  module BrowserId
3
3
  class Railtie < Rails::Railtie
4
- initializer "my_gem.view_helpers" do
4
+ initializer "browser_id.view_helpers" do
5
5
  ActionView::Base.send :include, ViewHelpers
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Devise
2
2
  module Browserid
3
- VERSION = "0.5.1"
3
+ VERSION = "0.5.2"
4
4
  end
5
5
  end
@@ -1,11 +1,22 @@
1
1
  module BrowserId
2
2
  module ViewHelpers
3
+
4
+ # BrowserID JavaScript tags:
5
+ # - The official BrowserID include.js
6
+ # - The Devise enabled login and assertion reponse
3
7
  def browserid_include_tag
4
- javascript_include_tag("https://#{ request.env['warden'].config.browserid_url }/include.js", "browserid")
8
+ javascript_include_tag(browserid_include_js_url, "browserid")
5
9
  end
6
10
 
11
+ # The BrowserID login button
7
12
  def browserid_login_tag
8
13
  image_tag("sign_in_blue.png", :onclick => "browserIdLogin();")
9
14
  end
15
+
16
+ # The URL to the BrowserID official JavaScript
17
+ def browserid_include_js_url
18
+ "https://#{ Warden::BrowserId::Strategy.browserid_url }/include." + (::Rails.env == "development" ? "orig.js" : ".js")
19
+ end
20
+
10
21
  end
11
22
  end
@@ -1,3 +1,6 @@
1
+ /*
2
+ * BrowserID API function: https://developer.mozilla.org/en/BrowserID/Quick_Setup
3
+ */
1
4
  function gotAssertion(assertion) {
2
5
  // got an assertion, now send it up to the server for verification
3
6
  if (assertion !== null) {
@@ -18,26 +21,30 @@ function gotAssertion(assertion) {
18
21
  }
19
22
  }
20
23
 
21
- function browserIdLogin() {
22
- navigator.id.get(function(assertion) {
23
- if (assertion) {
24
- // This code will be invoked once the user has successfully
25
- // selected an email address they control to sign in with.
26
- $.ajax({
27
- url:"/d/users/sign_in/",
28
- type: "POST",
29
- data: {"assertion": assertion},
30
- cache:false,
31
- success:function(data,status){
32
- window.location.href = '/';
33
- },
34
- error:function(data,status){
35
- alert(data.statusText + ": " + data.responseText);
36
- }
37
- })
38
- } else {
39
- // something went wrong! the user isn't logged in.
40
- alert("Could not log you in!");
41
- }
42
- });
43
- }
24
+ /*
25
+ * Our BrowserID login call. If the assertion was found, send this to Devise
26
+ * with warden-browserid enabled for verification and login.
27
+ */
28
+ function browserIdLogin() {
29
+ navigator.id.get(function(assertion) {
30
+ if (assertion) {
31
+ // This code will be invoked once the user has successfully
32
+ // selected an email address they control to sign in with.
33
+ $.ajax({
34
+ url:"/d/users/sign_in/",
35
+ type: "POST",
36
+ data: {"assertion": assertion},
37
+ cache:false,
38
+ success:function(data,status){
39
+ window.location.href = '/';
40
+ },
41
+ error:function(data,status){
42
+ alert(data.statusText + ": " + data.responseText);
43
+ }
44
+ })
45
+ } else {
46
+ // something went wrong! the user isn't logged in.
47
+ alert("Could not log you in!");
48
+ }
49
+ });
50
+ }
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.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,18 +13,18 @@ date: 2012-04-16 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: warden-browserid
16
- requirement: &15949380 !ruby/object:Gem::Requirement
16
+ requirement: &13162420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 0.8.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *15949380
24
+ version_requirements: *13162420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: devise
27
- requirement: &15948960 !ruby/object:Gem::Requirement
27
+ requirement: &13162000 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *15948960
35
+ version_requirements: *13162000
36
36
  description: BrowserID helpers for Devise
37
37
  email:
38
38
  - runar@rin.no