Module: AuthlogicRpx::Helper
- Defined in:
- lib/authlogic_rpx/helper.rb
Instance Method Summary collapse
-
#rpx_embed(options = {}) ⇒ Object
helper to insert an embedded iframe RPX login takes options hash: *
app_name:
name of the application (will be prepended to RPX domain and used in RPX dialogues) *return_url:
url for the RPX callback (e.g. user_sessions_url) *add_rpx:
if true, requests RPX callback to add to current session. -
#rpx_popup(options = {}) ⇒ Object
helper to insert a link to pop-up RPX login takes options hash: *
link_text:
text to use in the link *app_name:
name of the application (will be prepended to RPX domain and used in RPX dialogues) *return_url:
url for the RPX callback (e.g. user_sessions_url) *add_rpx:
if true, requests RPX callback to add to current session.
Instance Method Details
#rpx_embed(options = {}) ⇒ Object
helper to insert an embedded iframe RPX login takes options hash:
* <tt>app_name:</tt> name of the application (will be prepended to RPX domain and used in RPX dialogues)
* <tt>return_url:</tt> url for the RPX callback (e.g. user_sessions_url)
* <tt>add_rpx:</tt> if true, requests RPX callback to add to current session. Else runs normal authentication process (default)
10 11 12 13 14 15 |
# File 'lib/authlogic_rpx/helper.rb', line 10 def ( = {}) params = ( { :authenticity_token => form_authenticity_token, :add_rpx => [:add_rpx] }.collect { |n| "#{n[0]}=#{ u(n[1]) }" if n[1] } ).compact.join('&') RPXNow.([:app_name], u( [:return_url] + '?' + params ) ) end |
#rpx_popup(options = {}) ⇒ Object
helper to insert a link to pop-up RPX login takes options hash:
* <tt>link_text:</tt> text to use in the link
* <tt>app_name:</tt> name of the application (will be prepended to RPX domain and used in RPX dialogues)
* <tt>return_url:</tt> url for the RPX callback (e.g. user_sessions_url)
* <tt>add_rpx:</tt> if true, requests RPX callback to add to current session. Else runs normal authentication process (default)
* <tt>unobtrusive:</tt> true/false; sets javascript style for link. Default: true
NB: i18n considerations? supports a :language parameter (not tested)
26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/authlogic_rpx/helper.rb', line 26 def rpx_popup( = {}) params = ( { :authenticity_token => form_authenticity_token, :add_rpx => [:add_rpx] }.collect { |n| "#{n[0]}=#{ u(n[1]) }" if n[1] } ).compact.join('&') unobtrusive = [:unobtrusive].nil? ? true : [:unobtrusive] return_url = [:return_url] + '?' + params return_url = u( return_url ) if unobtrusive # double-encoding required only if unobtrusive mode used RPXNow.popup_code( [:link_text], [:app_name], return_url, :unobtrusive=>unobtrusive ) end |