authenticate 0.3.2 → 0.3.3

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 880f3ddf3bf73620d2ad00b9fa97961e0b9572cb
4
- data.tar.gz: 6f8552c11692b6ed41b86bc11d9ad325c54a3b63
3
+ metadata.gz: e7228f6e2ad7a6120f39b3a4af880c800bbed56b
4
+ data.tar.gz: 777e5b64fbd3ce703579d50c69283c0d661596ae
5
5
  SHA512:
6
- metadata.gz: f8ed33e95016c51092e3b082d51d04c8ab0787cf1f4d98d03a3aafe9f70aaef320beb5acc2653932053970c55c14db0b2d0cacd6deb7f6d26ec882564b113ed6
7
- data.tar.gz: 401d92cb7b48b1ce32c961c42901ff20ae586648d1e266b9d0f954a76fb6449a057d12a34fdb52a6e5e9f590297f39cf7a9a93d0b1eca340f6adfb1a57192cba
6
+ metadata.gz: 61e7ac6c14efb4722861c3cc95bdb49d09732dd674bec1a44dd8070a1a4dbe6bb7aae1f93dcc0034c78ad62369b508b38e96b0ca8d7549aa70cebc30bd3e90fc
7
+ data.tar.gz: c4ec2869d1c4aa5b108655533d6151ed5539d72a1a7efd8d4cc6213aa58f2c0a17af04e5c4f1b97cc2d2fe569c4149419f2d3973af10220c87ccc415c0c8d997
@@ -0,0 +1,38 @@
1
+ ---
2
+ engines:
3
+ brakeman:
4
+ enabled: true
5
+ bundler-audit:
6
+ enabled: true
7
+ duplication:
8
+ enabled: true
9
+ exclude_fingerprints:
10
+ - 120bdc2114c46391e7ad73ea4a10b314
11
+ - 339cd5bbb9922a29a82aaf5f3d727deb
12
+ config:
13
+ languages:
14
+ - ruby
15
+ - javascript
16
+ - python
17
+ - php
18
+ fixme:
19
+ enabled: true
20
+ rubocop:
21
+ enabled: true
22
+ ratings:
23
+ paths:
24
+ - Gemfile.lock
25
+ - "**.erb"
26
+ - "**.haml"
27
+ - "**.rb"
28
+ - "**.rhtml"
29
+ - "**.slim"
30
+ - "**.inc"
31
+ - "**.js"
32
+ - "**.jsx"
33
+ - "**.module"
34
+ - "**.php"
35
+ - "**.py"
36
+ exclude_paths:
37
+ - config/
38
+ - spec/
@@ -1,10 +1,24 @@
1
1
  # Authenticate Changelog
2
2
 
3
+ ## [0.3.3] - April 29, 2016
4
+
5
+ Password change uses active record's dirty bit to detect that password was updated.
6
+ password_updated attribute removed.
7
+ spec_helper now calls ActiveRecord::Migration.maintain_test_schema! (or check_pending!) to handle dummy test db.
8
+ Added CodeClimate config.
9
+
10
+ [0.3.3]: https://github.com/tomichj/authenticate/compare/v0.3.2...v0.3.3
11
+
12
+
13
+
3
14
  ## [0.3.2] - April 28, 2016
4
15
 
5
16
  Error now raised if User model is missing required attributes.
6
17
  All code now conforms to a rubocode profile.
7
18
 
19
+ [0.3.2]: https://github.com/tomichj/authenticate/compare/v0.3.1...v0.3.2
20
+
21
+
8
22
 
9
23
  ## [0.3.1] - March 10, 2016
10
24
 
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- authenticate (0.3.1)
4
+ authenticate (0.3.2)
5
5
  bcrypt (~> 3.1)
6
6
  email_validator (~> 1.6)
7
7
  rails (>= 4.0, < 5.1)
@@ -9,36 +9,36 @@ PATH
9
9
  GEM
10
10
  remote: https://rubygems.org/
11
11
  specs:
12
- actionmailer (4.2.5)
13
- actionpack (= 4.2.5)
14
- actionview (= 4.2.5)
15
- activejob (= 4.2.5)
12
+ actionmailer (4.2.6)
13
+ actionpack (= 4.2.6)
14
+ actionview (= 4.2.6)
15
+ activejob (= 4.2.6)
16
16
  mail (~> 2.5, >= 2.5.4)
17
17
  rails-dom-testing (~> 1.0, >= 1.0.5)
18
- actionpack (4.2.5)
19
- actionview (= 4.2.5)
20
- activesupport (= 4.2.5)
18
+ actionpack (4.2.6)
19
+ actionview (= 4.2.6)
20
+ activesupport (= 4.2.6)
21
21
  rack (~> 1.6)
22
22
  rack-test (~> 0.6.2)
23
23
  rails-dom-testing (~> 1.0, >= 1.0.5)
24
24
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
- actionview (4.2.5)
26
- activesupport (= 4.2.5)
25
+ actionview (4.2.6)
26
+ activesupport (= 4.2.6)
27
27
  builder (~> 3.1)
28
28
  erubis (~> 2.7.0)
29
29
  rails-dom-testing (~> 1.0, >= 1.0.5)
30
30
  rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
- activejob (4.2.5)
32
- activesupport (= 4.2.5)
31
+ activejob (4.2.6)
32
+ activesupport (= 4.2.6)
33
33
  globalid (>= 0.3.0)
34
- activemodel (4.2.5)
35
- activesupport (= 4.2.5)
34
+ activemodel (4.2.6)
35
+ activesupport (= 4.2.6)
36
36
  builder (~> 3.1)
37
- activerecord (4.2.5)
38
- activemodel (= 4.2.5)
39
- activesupport (= 4.2.5)
37
+ activerecord (4.2.6)
38
+ activemodel (= 4.2.6)
39
+ activesupport (= 4.2.6)
40
40
  arel (~> 6.0)
41
- activesupport (4.2.5)
41
+ activesupport (4.2.6)
42
42
  i18n (~> 0.7)
43
43
  json (~> 1.7, >= 1.7.7)
44
44
  minitest (~> 5.1)
@@ -46,23 +46,23 @@ GEM
46
46
  tzinfo (~> 1.1)
47
47
  addressable (2.4.0)
48
48
  arel (6.0.3)
49
- bcrypt (3.1.10)
49
+ bcrypt (3.1.11)
50
50
  builder (3.2.2)
51
- capybara (2.6.2)
51
+ capybara (2.7.0)
52
52
  addressable
53
53
  mime-types (>= 1.16)
54
54
  nokogiri (>= 1.3.3)
55
55
  rack (>= 1.0.0)
56
56
  rack-test (>= 0.5.4)
57
57
  xpath (~> 2.0)
58
- coderay (1.1.0)
58
+ coderay (1.1.1)
59
59
  concurrent-ruby (1.0.1)
60
- database_cleaner (1.5.1)
60
+ database_cleaner (1.5.3)
61
61
  diff-lcs (1.2.5)
62
62
  email_validator (1.6.0)
63
63
  activemodel
64
64
  erubis (2.7.0)
65
- factory_girl (4.4.0)
65
+ factory_girl (4.7.0)
66
66
  activesupport (>= 3.0.0)
67
67
  globalid (0.3.6)
68
68
  activesupport (>= 4.1.0)
@@ -70,13 +70,15 @@ GEM
70
70
  json (1.8.3)
71
71
  loofah (2.0.3)
72
72
  nokogiri (>= 1.5.9)
73
- mail (2.6.3)
74
- mime-types (>= 1.16, < 3)
73
+ mail (2.6.4)
74
+ mime-types (>= 1.16, < 4)
75
75
  method_source (0.8.2)
76
- mime-types (2.99)
76
+ mime-types (3.0)
77
+ mime-types-data (~> 3.2015)
78
+ mime-types-data (3.2016.0221)
77
79
  mini_portile2 (2.0.0)
78
- minitest (5.8.3)
79
- nokogiri (1.6.7.1)
80
+ minitest (5.8.4)
81
+ nokogiri (1.6.7.2)
80
82
  mini_portile2 (~> 2.0.0.rc2)
81
83
  pry (0.10.3)
82
84
  coderay (~> 1.1.0)
@@ -85,16 +87,16 @@ GEM
85
87
  rack (1.6.4)
86
88
  rack-test (0.6.3)
87
89
  rack (>= 1.0)
88
- rails (4.2.5)
89
- actionmailer (= 4.2.5)
90
- actionpack (= 4.2.5)
91
- actionview (= 4.2.5)
92
- activejob (= 4.2.5)
93
- activemodel (= 4.2.5)
94
- activerecord (= 4.2.5)
95
- activesupport (= 4.2.5)
90
+ rails (4.2.6)
91
+ actionmailer (= 4.2.6)
92
+ actionpack (= 4.2.6)
93
+ actionview (= 4.2.6)
94
+ activejob (= 4.2.6)
95
+ activemodel (= 4.2.6)
96
+ activerecord (= 4.2.6)
97
+ activesupport (= 4.2.6)
96
98
  bundler (>= 1.3.0, < 2.0)
97
- railties (= 4.2.5)
99
+ railties (= 4.2.6)
98
100
  sprockets-rails
99
101
  rails-deprecated_sanitizer (1.0.3)
100
102
  activesupport (>= 4.2.0.alpha)
@@ -102,34 +104,35 @@ GEM
102
104
  activesupport (>= 4.2.0.beta, < 5.0)
103
105
  nokogiri (~> 1.6.0)
104
106
  rails-deprecated_sanitizer (>= 1.0.1)
105
- rails-html-sanitizer (1.0.2)
107
+ rails-html-sanitizer (1.0.3)
106
108
  loofah (~> 2.0)
107
- railties (4.2.5)
108
- actionpack (= 4.2.5)
109
- activesupport (= 4.2.5)
109
+ railties (4.2.6)
110
+ actionpack (= 4.2.6)
111
+ activesupport (= 4.2.6)
110
112
  rake (>= 0.8.7)
111
113
  thor (>= 0.18.1, < 2.0)
112
- rake (10.4.2)
113
- rspec-core (3.1.7)
114
- rspec-support (~> 3.1.0)
115
- rspec-expectations (3.1.2)
114
+ rake (11.1.2)
115
+ rspec-core (3.4.4)
116
+ rspec-support (~> 3.4.0)
117
+ rspec-expectations (3.4.0)
116
118
  diff-lcs (>= 1.2.0, < 2.0)
117
- rspec-support (~> 3.1.0)
118
- rspec-mocks (3.1.3)
119
- rspec-support (~> 3.1.0)
120
- rspec-rails (3.1.0)
121
- actionpack (>= 3.0)
122
- activesupport (>= 3.0)
123
- railties (>= 3.0)
124
- rspec-core (~> 3.1.0)
125
- rspec-expectations (~> 3.1.0)
126
- rspec-mocks (~> 3.1.0)
127
- rspec-support (~> 3.1.0)
128
- rspec-support (3.1.2)
119
+ rspec-support (~> 3.4.0)
120
+ rspec-mocks (3.4.1)
121
+ diff-lcs (>= 1.2.0, < 2.0)
122
+ rspec-support (~> 3.4.0)
123
+ rspec-rails (3.4.2)
124
+ actionpack (>= 3.0, < 4.3)
125
+ activesupport (>= 3.0, < 4.3)
126
+ railties (>= 3.0, < 4.3)
127
+ rspec-core (~> 3.4.0)
128
+ rspec-expectations (~> 3.4.0)
129
+ rspec-mocks (~> 3.4.0)
130
+ rspec-support (~> 3.4.0)
131
+ rspec-support (3.4.1)
129
132
  shoulda-matchers (2.8.0)
130
133
  activesupport (>= 3.0.0)
131
134
  slop (3.6.0)
132
- sprockets (3.5.2)
135
+ sprockets (3.6.0)
133
136
  concurrent-ruby (~> 1.0)
134
137
  rack (> 1, < 3)
135
138
  sprockets-rails (3.0.4)
@@ -139,7 +142,7 @@ GEM
139
142
  sqlite3 (1.3.11)
140
143
  thor (0.19.1)
141
144
  thread_safe (0.3.5)
142
- timecop (0.8.0)
145
+ timecop (0.8.1)
143
146
  tzinfo (1.2.2)
144
147
  thread_safe (~> 0.1)
145
148
  xpath (2.0.0)
@@ -33,7 +33,6 @@ module Authenticate
33
33
  private_class_method :crypto_provider
34
34
  include crypto_provider
35
35
  attr_reader :password
36
- attr_accessor :password_changing
37
36
  validates :password,
38
37
  presence: true,
39
38
  length: { in: password_length },
@@ -46,7 +45,7 @@ module Authenticate
46
45
 
47
46
  def password=(new_password)
48
47
  @password = new_password
49
- self.encrypted_password = encrypt(new_password) if new_password.present?
48
+ self.encrypted_password = encrypt(new_password) unless new_password.nil?
50
49
  end
51
50
 
52
51
  private
@@ -65,7 +64,7 @@ module Authenticate
65
64
 
66
65
  # If we already have an encrypted password and it's not changing, skip the validation.
67
66
  def skip_password_validation?
68
- encrypted_password.present? && !password_changing
67
+ encrypted_password.present? && !encrypted_password_changed?
69
68
  end
70
69
  end
71
70
  end
@@ -31,15 +31,11 @@ module Authenticate
31
31
  # @return [Boolean] Was the save successful?
32
32
  def update_password(new_password)
33
33
  return false unless reset_password_period_valid?
34
-
35
- self.password_changing = true
36
34
  self.password = new_password
37
-
38
35
  if valid?
39
36
  clear_reset_password_token
40
37
  generate_session_token
41
38
  end
42
-
43
39
  save
44
40
  end
45
41
 
@@ -46,7 +46,7 @@ module Authenticate
46
46
  # @return [User]
47
47
  def current_user
48
48
  debug 'session.current_user'
49
- @current_user ||= load_user if @session_token.present?
49
+ @current_user ||= load_user_from_session_token if @session_token.present?
50
50
  @current_user
51
51
  end
52
52
 
@@ -97,7 +97,7 @@ module Authenticate
97
97
  Authenticate.configuration.cookie_name.freeze.to_sym
98
98
  end
99
99
 
100
- def load_user
100
+ def load_user_from_session_token
101
101
  Authenticate.configuration.user_model_class.where(session_token: @session_token).first
102
102
  end
103
103
  end
@@ -1,3 +1,3 @@
1
1
  module Authenticate
2
- VERSION = '0.3.2'.freeze
2
+ VERSION = '0.3.3'.freeze
3
3
  end
@@ -33,14 +33,12 @@ describe Authenticate::Model::DbPassword do
33
33
  it 'should be not be valid with a short password' do
34
34
  user = build(:user)
35
35
  user.password = 'short'
36
- user.password_changing = true
37
36
  expect(user).to_not be_valid
38
37
  end
39
38
 
40
39
  it 'is valid with a long password' do
41
40
  user = build(:user)
42
41
  user.password = 'thisisalongpassword'
43
- user.password_changing = true
44
42
  expect(user).to be_valid
45
43
  end
46
44
  end
@@ -52,13 +50,11 @@ describe Authenticate::Model::DbPassword do
52
50
 
53
51
  it 'should not be valid with an empty password' do
54
52
  subject.password = ''
55
- subject.password_changing = true
56
53
  expect(subject).to_not be_valid
57
54
  end
58
55
 
59
56
  it 'should be valid with a new (valid) password' do
60
57
  subject.password = 'new password'
61
- subject.password_changing = true
62
58
  expect(subject).to be_valid
63
59
  end
64
60
  end
@@ -20,6 +20,13 @@ DatabaseCleaner.strategy = :truncation
20
20
  # Load factory girl factories.
21
21
  Dir[File.join(File.dirname(__FILE__), 'factories/**/*.rb')].each { |f| require f }
22
22
 
23
+ # Build test database in spec/dummy/db/
24
+ if defined?(ActiveRecord::Migration.maintain_test_schema!)
25
+ ActiveRecord::Migration.maintain_test_schema! # rails 4.1+
26
+ else
27
+ ActiveRecord::Migration.check_pending! # rails 4.0
28
+ end
29
+
23
30
  RSpec.configure do |config|
24
31
  config.include FactoryGirl::Syntax::Methods
25
32
  config.infer_spec_type_from_file_location!
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authenticate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Tomich
@@ -180,6 +180,7 @@ extra_rdoc_files:
180
180
  - README.md
181
181
  - CHANGELOG.md
182
182
  files:
183
+ - ".codeclimate.yml"
183
184
  - ".gitignore"
184
185
  - ".rspec"
185
186
  - ".rubocop.yml"
@@ -296,13 +297,11 @@ files:
296
297
  - spec/dummy/config/locales/en.yml
297
298
  - spec/dummy/config/routes.rb
298
299
  - spec/dummy/config/secrets.yml
299
- - spec/dummy/db/development.sqlite3
300
300
  - spec/dummy/db/migrate/20160130192728_create_users.rb
301
301
  - spec/dummy/db/migrate/20160130192729_add_authenticate_brute_force_to_users.rb
302
302
  - spec/dummy/db/migrate/20160130192730_add_authenticate_timeoutable_to_users.rb
303
303
  - spec/dummy/db/migrate/20160130192731_add_authenticate_password_reset_to_users.rb
304
304
  - spec/dummy/db/schema.rb
305
- - spec/dummy/db/test.sqlite3
306
305
  - spec/dummy/lib/assets/.keep
307
306
  - spec/dummy/log/.keep
308
307
  - spec/dummy/public/404.html