omniauth-naranya_id 0.0.7 → 0.0.8

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ba256048e9c8b966cc79af434fc0d5397ff5ab18
4
- data.tar.gz: 34a0e867a161f76d21be126eee7f2bda3644091e
3
+ metadata.gz: 5320911842aaf50c3cfaf42a186b784ba4546af9
4
+ data.tar.gz: af8e77bff0ebcc8816d2a8f54a143f3026db8eed
5
5
  SHA512:
6
- metadata.gz: cc946786f9db73d9b69d459cf00663abc4c56310717aea0a657bd8101c5d7fdac5c3712b74fe7a8039f5fa85ff72b61bbeac7f59176ec84f50a33a510af180aa
7
- data.tar.gz: 20ba6eea2a612917b7d0fe52e4b83aa074a48028e071b51cf245964b02452660f8191456a12ffc97f5660f02183de42372ee6e94c7ff9a62be46ff1f86c3eadd
6
+ metadata.gz: ed351cb2d73d9fd6cc0b9eef553c8c9ded0e5210fc89414b50973fe3524ccfd5a7bd03e5d122cdfebec19f105408b275de01d20045ca75ed6e2cafbd55568bf7
7
+ data.tar.gz: e754d80586d1807490b1367b8c98ca7be1a1a574e308a399db0e5ea05cd82e99a946f81c100b12e52311fc6a2680e36b230b373c3c790c2f4c29d03e01dbff32
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module NaranyaId
3
- VERSION = "0.0.7"
3
+ VERSION = "0.0.8"
4
4
  end
5
5
  end
@@ -31,17 +31,12 @@ module OmniAuth
31
31
  session['oauth'][name.to_s] = {'callback_confirmed' => request_token.callback_confirmed?, 'request_token' => request_token.token, 'request_secret' => request_token.secret}
32
32
 
33
33
  # Setup de parametros de lang/locale:
34
- set_locale
35
- locale_params = if defined?(I18n) && I18n.respond_to?(:locale) && I18n.locale.present?
36
- { lang: I18n.locale.to_s.split('-').first, locale: I18n.locale.to_s }
37
- else
38
- {}
39
- end
40
-
34
+ authorize_params = options[:authorize_params].merge locale_params
35
+
41
36
  if request_token.callback_confirmed?
42
- redirect request_token.authorize_url(options[:authorize_params].merge(locale_params))
37
+ redirect request_token.authorize_url authorize_params
43
38
  else
44
- redirect request_token.authorize_url(options[:authorize_params].merge(:oauth_callback => callback_url).merge(locale_params))
39
+ redirect request_token.authorize_url(authorize_params.merge(:oauth_callback => callback_url))
45
40
  end
46
41
 
47
42
  rescue ::Timeout::Error => e
@@ -106,11 +101,15 @@ module OmniAuth
106
101
 
107
102
  private
108
103
 
109
- def set_locale
110
- client_locale = if request.params[:locale].present?
111
- request.params[:locale]
112
- end
104
+ def locale_params
105
+ _loc_params = {}
113
106
 
107
+ params = request.params.with_indifferent_access
108
+
109
+ client_locale = if params[:locale].present?
110
+ params[:locale]
111
+ end
112
+
114
113
  if client_locale.present?
115
114
  # If the complete locale is not available, we'll use the language part of the client locale:
116
115
  client_language = client_locale.split('-').first
@@ -118,13 +117,18 @@ module OmniAuth
118
117
  # User the client_locale or the client_language, if the former is not available:
119
118
  if defined?(I18n) && I18n.respond_to?(:locale_available?) && I18n.respond_to?(:locale)
120
119
  if I18n.locale_available? client_locale
121
- I18n.locale = client_locale
122
- elsif I18n.locale_available? client_language
123
- I18n.locale = client_language
120
+ _loc_params[:locale] = client_locale
121
+ _loc_params[:lang] = client_language
122
+ OmniAuth.logger.debug "The client's locale '#{client_locale}' is available in the app, and will be sent to OAuth site"
123
+ else
124
+ OmniAuth.logger.debug "The client's locale '#{client_locale}' is not available in the app, and will not be sent to OAuth site"
124
125
  end
125
126
  end
127
+
126
128
  end
127
129
 
130
+ _loc_params
131
+
128
132
  end
129
133
 
130
134
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-naranya_id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.7
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla