authenticate 0.4.0 → 0.5.0

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: ea02dca780db9b1997f303292607eb14b4bd8f1f
4
- data.tar.gz: 40d0f2e1d7fb0deb3e05efab7660c4d3a0cd7bc1
3
+ metadata.gz: ba37abc88aa432eb70096681623f51de2ccac5fb
4
+ data.tar.gz: d836124e6f702044bdaa98d4cb46a54967c586b8
5
5
  SHA512:
6
- metadata.gz: 1f966853f7b47fa644004698d7e19eb4de73632bed219782a432d3ca0177da920ee16849fbad7d1642ab6bd69fe83378a7e013e6ad9e26b91f0faf7b913a65f2
7
- data.tar.gz: 7573e19a7a40e352f41b7f7c4cf79010924459ee8b8e0725aa0c58cdef24f74c29277ab018b1746af87cda851263aec565bb12235f0947b3966e3a684743ba75
6
+ metadata.gz: d2e1fe07144aee9fb948d4f8b6b0932785ba2ce0dc00ca927d17a9e5dc1529cecbd121ccdf985388176e62c7315723ec78f5b956e2f29d4fd6a1c0b88fa980c9
7
+ data.tar.gz: 95b8c5be797479eb243ba7b45f3833033aafab28f54a0f7579127387754d5a40018356c39f0f9411f86a0ee4dfc9e38e6acf1e9088dde16eae679926d19d396b
data/.gitignore CHANGED
@@ -8,3 +8,5 @@ spec/dummy/log/*.log
8
8
  spec/dummy/tmp/
9
9
  spec/dummy/log/test.log
10
10
  spec/dummy/log/development.log
11
+ /.idea
12
+ Gemfile.lock
data/README.md CHANGED
@@ -241,7 +241,7 @@ $ rails generate authenticate:routes
241
241
 
242
242
  Now update `config/routes.rb` to point to your new controller:
243
243
  ```ruby
244
- resource :session, controller: 'sessions', only: [:create, :new, :destroy]
244
+ resource :sessions, controller: 'sessions', only: [:create, :new, :destroy]
245
245
  ...
246
246
  ```
247
247
 
@@ -338,7 +338,7 @@ module LoginCount
338
338
 
339
339
  def count_login
340
340
  self.login_count ||= 0
341
- self.login_counter += 1
341
+ self.login_count += 1
342
342
  end
343
343
  end
344
344
 
@@ -1,5 +1,5 @@
1
1
  #
2
- # Controller to reate new users.
2
+ # Controller to create new users.
3
3
  #
4
4
  class Authenticate::UsersController < Authenticate::AuthenticateController
5
5
  before_action :redirect_signed_in_users, only: [:create, :new]
data/authenticate.gemspec CHANGED
@@ -23,7 +23,7 @@ Gem::Specification.new do |s|
23
23
 
24
24
  s.add_dependency 'bcrypt', '~> 3.1'
25
25
  s.add_dependency 'email_validator', '~> 1.6'
26
- s.add_dependency 'rails', '>= 4.0', '< 5.1'
26
+ s.add_dependency 'rails', '>= 4.0', '< 5.2'
27
27
 
28
28
  s.add_development_dependency 'factory_girl', '~> 4.4'
29
29
  s.add_development_dependency 'rspec-rails', '~> 3.1'
@@ -63,6 +63,7 @@ module Authenticate
63
63
  def reset_password_period_valid?
64
64
  reset_within = Authenticate.configuration.reset_password_within
65
65
  return true if reset_within.nil?
66
+ return true if password_reset_sent_at.nil? && password_reset_token.nil?
66
67
  password_reset_sent_at && password_reset_sent_at.utc >= reset_within.ago.utc
67
68
  end
68
69
 
@@ -2,6 +2,10 @@ module Authenticate
2
2
  #
3
3
  # Modules injects Authenticate modules into the app User model.
4
4
  #
5
+ # Modules are loaded into the user model with class method `load_modules`. Authenticate::User calls
6
+ # `load_modules`. Modules are specified in the config as constants; `load_modules` requires them,
7
+ # turns them into constants, checks for required fields (see below), and then includes them into the user.
8
+ #
5
9
  # Any module being loaded into User can optionally define a class method `required_fields(klass)` defining
6
10
  # any required attributes in the User model. For example, the :username module declares:
7
11
  #
@@ -15,6 +19,8 @@ module Authenticate
15
19
  #
16
20
  # If the model class is missing a required field, Authenticate will fail with a MissingAttribute error.
17
21
  # The error will declare what required fields are missing.
22
+ #
23
+ #
18
24
  module Modules
19
25
  extend ActiveSupport::Concern
20
26
  #
@@ -1,3 +1,3 @@
1
1
  module Authenticate
2
- VERSION = '0.4.0'.freeze
2
+ VERSION = '0.5.0'.freeze
3
3
  end
@@ -57,11 +57,20 @@ describe Authenticate::Model::PasswordReset do
57
57
  subject.update_password 'password2'
58
58
  expect(subject.session_token).to_not eq(token)
59
59
  end
60
+
61
+ it 'prevents update if token is nil'
60
62
  end
61
63
 
62
64
  it 'stops password update after time limit' do
63
65
  subject.password_reset_sent_at = 6.minutes.ago
64
66
  expect(subject.update_password('password2')).to be_falsey
65
67
  end
68
+
69
+ it 'stops password update if password_reset_token set but password_reset_sent_at isnt' do
70
+ subject.password_reset_sent_at = nil
71
+ subject.password_reset_token = 'notNilResetToken'
72
+ expect(subject.update_password('password2')).to be_falsey
73
+ end
66
74
  end
67
75
  end
76
+
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: authenticate
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.0
4
+ version: 0.5.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Justin Tomich
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-06-03 00:00:00.000000000 Z
11
+ date: 2017-03-27 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bcrypt
@@ -47,7 +47,7 @@ dependencies:
47
47
  version: '4.0'
48
48
  - - "<"
49
49
  - !ruby/object:Gem::Version
50
- version: '5.1'
50
+ version: '5.2'
51
51
  type: :runtime
52
52
  prerelease: false
53
53
  version_requirements: !ruby/object:Gem::Requirement
@@ -57,7 +57,7 @@ dependencies:
57
57
  version: '4.0'
58
58
  - - "<"
59
59
  - !ruby/object:Gem::Version
60
- version: '5.1'
60
+ version: '5.2'
61
61
  - !ruby/object:Gem::Dependency
62
62
  name: factory_girl
63
63
  requirement: !ruby/object:Gem::Requirement
@@ -189,7 +189,6 @@ files:
189
189
  - CHANGELOG.md
190
190
  - CONTRIBUTING.md
191
191
  - Gemfile
192
- - Gemfile.lock
193
192
  - LICENSE
194
193
  - README.md
195
194
  - Rakefile
data/Gemfile.lock DELETED
@@ -1,166 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- authenticate (0.4.0)
5
- bcrypt (~> 3.1)
6
- email_validator (~> 1.6)
7
- rails (>= 4.0, < 5.1)
8
-
9
- GEM
10
- remote: https://rubygems.org/
11
- specs:
12
- actionmailer (4.2.6)
13
- actionpack (= 4.2.6)
14
- actionview (= 4.2.6)
15
- activejob (= 4.2.6)
16
- mail (~> 2.5, >= 2.5.4)
17
- rails-dom-testing (~> 1.0, >= 1.0.5)
18
- actionpack (4.2.6)
19
- actionview (= 4.2.6)
20
- activesupport (= 4.2.6)
21
- rack (~> 1.6)
22
- rack-test (~> 0.6.2)
23
- rails-dom-testing (~> 1.0, >= 1.0.5)
24
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
25
- actionview (4.2.6)
26
- activesupport (= 4.2.6)
27
- builder (~> 3.1)
28
- erubis (~> 2.7.0)
29
- rails-dom-testing (~> 1.0, >= 1.0.5)
30
- rails-html-sanitizer (~> 1.0, >= 1.0.2)
31
- activejob (4.2.6)
32
- activesupport (= 4.2.6)
33
- globalid (>= 0.3.0)
34
- activemodel (4.2.6)
35
- activesupport (= 4.2.6)
36
- builder (~> 3.1)
37
- activerecord (4.2.6)
38
- activemodel (= 4.2.6)
39
- activesupport (= 4.2.6)
40
- arel (~> 6.0)
41
- activesupport (4.2.6)
42
- i18n (~> 0.7)
43
- json (~> 1.7, >= 1.7.7)
44
- minitest (~> 5.1)
45
- thread_safe (~> 0.3, >= 0.3.4)
46
- tzinfo (~> 1.1)
47
- addressable (2.4.0)
48
- arel (6.0.3)
49
- bcrypt (3.1.11)
50
- builder (3.2.2)
51
- capybara (2.7.0)
52
- addressable
53
- mime-types (>= 1.16)
54
- nokogiri (>= 1.3.3)
55
- rack (>= 1.0.0)
56
- rack-test (>= 0.5.4)
57
- xpath (~> 2.0)
58
- coderay (1.1.1)
59
- concurrent-ruby (1.0.2)
60
- database_cleaner (1.5.3)
61
- diff-lcs (1.2.5)
62
- email_validator (1.6.0)
63
- activemodel
64
- erubis (2.7.0)
65
- factory_girl (4.7.0)
66
- activesupport (>= 3.0.0)
67
- globalid (0.3.6)
68
- activesupport (>= 4.1.0)
69
- i18n (0.7.0)
70
- json (1.8.3)
71
- loofah (2.0.3)
72
- nokogiri (>= 1.5.9)
73
- mail (2.6.4)
74
- mime-types (>= 1.16, < 4)
75
- method_source (0.8.2)
76
- mime-types (3.0)
77
- mime-types-data (~> 3.2015)
78
- mime-types-data (3.2016.0221)
79
- mini_portile2 (2.0.0)
80
- minitest (5.8.4)
81
- nokogiri (1.6.7.2)
82
- mini_portile2 (~> 2.0.0.rc2)
83
- pry (0.10.3)
84
- coderay (~> 1.1.0)
85
- method_source (~> 0.8.1)
86
- slop (~> 3.4)
87
- rack (1.6.4)
88
- rack-test (0.6.3)
89
- rack (>= 1.0)
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)
98
- bundler (>= 1.3.0, < 2.0)
99
- railties (= 4.2.6)
100
- sprockets-rails
101
- rails-deprecated_sanitizer (1.0.3)
102
- activesupport (>= 4.2.0.alpha)
103
- rails-dom-testing (1.0.7)
104
- activesupport (>= 4.2.0.beta, < 5.0)
105
- nokogiri (~> 1.6.0)
106
- rails-deprecated_sanitizer (>= 1.0.1)
107
- rails-html-sanitizer (1.0.3)
108
- loofah (~> 2.0)
109
- railties (4.2.6)
110
- actionpack (= 4.2.6)
111
- activesupport (= 4.2.6)
112
- rake (>= 0.8.7)
113
- thor (>= 0.18.1, < 2.0)
114
- rake (11.1.2)
115
- rspec-core (3.4.4)
116
- rspec-support (~> 3.4.0)
117
- rspec-expectations (3.4.0)
118
- diff-lcs (>= 1.2.0, < 2.0)
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)
132
- shoulda-matchers (2.8.0)
133
- activesupport (>= 3.0.0)
134
- slop (3.6.0)
135
- sprockets (3.6.0)
136
- concurrent-ruby (~> 1.0)
137
- rack (> 1, < 3)
138
- sprockets-rails (3.0.4)
139
- actionpack (>= 4.0)
140
- activesupport (>= 4.0)
141
- sprockets (>= 3.0.0)
142
- sqlite3 (1.3.11)
143
- thor (0.19.1)
144
- thread_safe (0.3.5)
145
- timecop (0.8.1)
146
- tzinfo (1.2.2)
147
- thread_safe (~> 0.1)
148
- xpath (2.0.0)
149
- nokogiri (~> 1.3)
150
-
151
- PLATFORMS
152
- ruby
153
-
154
- DEPENDENCIES
155
- authenticate!
156
- capybara (~> 2.6)
157
- database_cleaner (~> 1.5)
158
- factory_girl (~> 4.4)
159
- pry (~> 0.10)
160
- rspec-rails (~> 3.1)
161
- shoulda-matchers (~> 2.8)
162
- sqlite3 (~> 1.3)
163
- timecop (~> 0.8)
164
-
165
- BUNDLED WITH
166
- 1.11.2