omniauth-mobileid 0.1.0 → 0.1.1

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.
@@ -38,7 +38,7 @@ module OmniAuth
38
38
  def perform_authentication
39
39
  debug 'perform_authentication'
40
40
  @auth_data = authenticate(request.params['phone'], request.params['personal_code'])
41
- debug @auth_data.inspect
41
+ debug user_data.inspect
42
42
 
43
43
  if user_data[:status] == 'OK'
44
44
  @env['omniauth.auth'] = auth_hash
@@ -47,7 +47,7 @@ module OmniAuth
47
47
  @env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback"
48
48
  call_app!
49
49
  else
50
- fail!(:invalid_credentials, @auth_data)
50
+ fail!(failure_reason)
51
51
  end
52
52
  end
53
53
 
@@ -61,13 +61,20 @@ module OmniAuth
61
61
  @env['PATH_INFO'] = "#{OmniAuth.config.path_prefix}/#{name}/callback"
62
62
  call_app!
63
63
  else
64
- fail!(:invalid_credentials, @auth_data)
64
+ fail!(failure_reason)
65
65
  end
66
66
  end
67
67
 
68
68
  def callback_phase
69
69
  debug "callback_phase"
70
- fail!(:invalid_credentials)
70
+ fail!(failure_reason)
71
+ end
72
+
73
+ def failure_reason
74
+ return :invalid_credentials if user_data.blank?
75
+
76
+ code = (user_data[:faultstring] || user_data[:status]).try(:downcase)
77
+ "error_#{code || 'unknown'}"
71
78
  end
72
79
 
73
80
  def user_data
@@ -1,5 +1,5 @@
1
1
  module Omniauth
2
2
  module Mobileid
3
- VERSION = "0.1.0"
3
+ VERSION = "0.1.1"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-mobileid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2012-04-14 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: omniauth-oauth
16
- requirement: &70197089089740 !ruby/object:Gem::Requirement
16
+ requirement: &70102490822720 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '1.0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70197089089740
24
+ version_requirements: *70102490822720
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: digidoc_client
27
- requirement: &70197089102480 !ruby/object:Gem::Requirement
27
+ requirement: &70102490820040 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: '0.1'
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70197089102480
35
+ version_requirements: *70102490820040
36
36
  description: OmniAuth strategy for Estonian Mobile-ID
37
37
  email:
38
38
  - tarmo.talu@gmail.com