google-authenticator-rails 0.0.4 → 0.0.6

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -102,6 +102,15 @@ gem 'rails'
102
102
  gem 'google-authenticator-rails'
103
103
  ```
104
104
 
105
+ First add a field to your user model to hold the Google token.
106
+ ```ruby
107
+ class AddGoogleSecretToUser < ActiveRecord::Migration
108
+ def change
109
+ add_column :users, :google_secret, :string
110
+ end
111
+ end
112
+ ```
113
+
105
114
  ```ruby
106
115
  app/models/users.rb
107
116
 
@@ -115,7 +124,7 @@ If you want to authenticate based on a model called `User`, then you should name
115
124
  ```ruby
116
125
  app/models/user_mfa_session.rb
117
126
 
118
- class UserMfaSession < GoogleAuthenticator::Session::Base
127
+ class UserMfaSession < GoogleAuthenticatorRails::Session::Base
119
128
  # no real code needed here
120
129
  end
121
130
  ```
@@ -151,7 +160,7 @@ class ApplicationController < ActionController::Base
151
160
 
152
161
  private
153
162
  def check_mfa
154
- if !(user_mfa_session = UserMfaSession.find) && user_mfa_session.record == current_user
163
+ if !(user_mfa_session = UserMfaSession.find) && (user_mfa_session ? user_mfa_session.record == current_user : !user_mfa_session)
155
164
  redirect_to new_user_mfa_session_path
156
165
  end
157
166
  end
@@ -15,8 +15,8 @@ Gem::Specification.new do |gem|
15
15
  gem.require_paths = ["lib"]
16
16
  gem.version = Google::Authenticator::Rails::VERSION
17
17
 
18
- gem.add_dependency "rotp"
19
- gem.add_dependency "activerecord"
18
+ gem.add_dependency "rotp", "= 1.4.1"
19
+ gem.add_dependency "activerecord", "< 4.0.0"
20
20
  gem.add_dependency "google-qr"
21
21
  gem.add_dependency "actionpack"
22
22
 
@@ -1,7 +1,7 @@
1
1
  module Google
2
2
  module Authenticator
3
3
  module Rails
4
- VERSION = "0.0.4"
4
+ VERSION = "0.0.6"
5
5
  end
6
6
  end
7
7
  end
data/spec/spec_helper.rb CHANGED
@@ -37,12 +37,12 @@ class MockCookieJar < Hash
37
37
  def delete(key, options = {})
38
38
  super(key)
39
39
  end
40
- end
40
+ end
41
41
 
42
42
  class UserMfaSession < GoogleAuthenticatorRails::Session::Base; end
43
43
 
44
44
  ActiveRecord::Base.establish_connection(
45
- :adapter => 'sqlite3',
45
+ :adapter => 'sqlite3',
46
46
  :database => ':memory:'
47
47
  )
48
48
 
@@ -70,7 +70,7 @@ ActiveRecord::Schema.define do
70
70
  end
71
71
 
72
72
  class BaseUser < ActiveRecord::Base
73
- attr_accessible :email, :user_name
73
+ attr_accessible :email, :user_name, :password
74
74
  self.table_name = "users"
75
75
 
76
76
  before_save do |user|
@@ -78,7 +78,7 @@ class BaseUser < ActiveRecord::Base
78
78
  end
79
79
  end
80
80
 
81
- class User < BaseUser
81
+ class User < BaseUser
82
82
  acts_as_google_authenticated
83
83
  end
84
84
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: google-authenticator-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,40 +9,40 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-03-12 00:00:00.000000000 Z
12
+ date: 2014-01-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rotp
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
- - - ! '>='
19
+ - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: '0'
21
+ version: 1.4.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
- - - ! '>='
27
+ - - '='
28
28
  - !ruby/object:Gem::Version
29
- version: '0'
29
+ version: 1.4.1
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: activerecord
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ! '>='
35
+ - - <
36
36
  - !ruby/object:Gem::Version
37
- version: '0'
37
+ version: 4.0.0
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ! '>='
43
+ - - <
44
44
  - !ruby/object:Gem::Version
45
- version: '0'
45
+ version: 4.0.0
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: google-qr
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -171,3 +171,4 @@ test_files:
171
171
  - spec/session/activation_spec.rb
172
172
  - spec/session/persistance_spec.rb
173
173
  - spec/spec_helper.rb
174
+ has_rdoc: