Module: BrowserId::ViewHelpers
- Defined in:
- lib/browserid-provider/view_helpers.rb
Instance Method Summary collapse
-
#browserid_authentication_api_js_url ⇒ Object
The URL to the BrowserID official JavaScript.
-
#browserid_authentication_tag ⇒ Object
BrowserID JavaScript tags: - The official BrowserID include.js - The Devise enabled login and assertion reponse.
-
#enable_browserid_javascript_tag(id) ⇒ Object
JavaScript enable BrowserID authentication for the form with the given #id.
Instance Method Details
#browserid_authentication_api_js_url ⇒ Object
The URL to the BrowserID official JavaScript
33 34 35 |
# File 'lib/browserid-provider/view_helpers.rb', line 33 def browserid_authentication_api_js_url "https://#{ request.env['browserid'][:browserid_url] }/authentication_api.js" end |
#browserid_authentication_tag ⇒ Object
BrowserID JavaScript tags:
-
The official BrowserID include.js
-
The Devise enabled login and assertion reponse
7 8 9 |
# File 'lib/browserid-provider/view_helpers.rb', line 7 def browserid_authentication_tag javascript_include_tag(browserid_authentication_api_js_url) end |
#enable_browserid_javascript_tag(id) ⇒ Object
JavaScript enable BrowserID authentication for the form with the given #id
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/browserid-provider/view_helpers.rb', line 12 def enable_browserid_javascript_tag(id) raw <<EOF <script type='text/javascript'> (function() { function fail() { var msg = 'user is not authenticated as target user'; navigator.id.raiseAuthenticationFailure(msg); }; $('form##{id}').bind('ajax:success', function(data, status, xhr) { navigator.id.completeAuthentication() }) $('form##{id}').bind('ajax:error', function(data, status, xhr) { fail(); }) navigator.id.beginAuthentication(function(email) { $('form##{id} #user_email').val(email); }); }()); </script> EOF end |