token_authenticate_me 0.5.6 → 0.5.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +5 -1
- data/db/migrate/20170629224206_add_index_to_users.rb +5 -0
- data/lib/token_authenticate_me/concerns/models/authenticatable.rb +3 -2
- data/lib/token_authenticate_me/version.rb +1 -1
- data/test/dummy/log/development.log +0 -0
- data/test/dummy/log/test.log +0 -0
- metadata +7 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 509fcc56e281bf06c8bb928a4f0ef6816f8cb09c
|
4
|
+
data.tar.gz: e0a28f6fa5c251cb1b944ed797c3d4283379a3f8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f3014461602e15776484fad138a4f4d7fd74debccccb0a734405444fac37ddd49e462dc29fdd51b33b16d9265b1f83e43e1924928765096e98fd33deab107149
|
7
|
+
data.tar.gz: 0bb78b95149534e41ce153c83792f25c54a6704ecd121b2b0388da638c3d268363d7632c59c6c8cef850e6befe07d57c05c7db6aab6cc1c5cc3ac5db7b2280bc
|
data/README.md
CHANGED
@@ -3,7 +3,11 @@ TokenAuthenticateMe
|
|
3
3
|
|
4
4
|
This gem adds simple API based token authentication. We at [inigo](http://inigo.io) wanted to be able to handle our entire authentication process -- including account creation and logging in -- through a RESTful API over JSON using token authentication, and found that solutions like Devise required too much hand holding due to its complexity to ultimately get the functionality that we wanted. Unfortunately we were unable to find a satisfactory existing solution -- though I'm sure one does exist, this isn't a new problem -- so we set out to create our own. After using internally on one project, we decided to roll it out into a gem to use on another.
|
5
5
|
|
6
|
-
##
|
6
|
+
## Upgrade Instructions
|
7
|
+
- For all major and minor run: `rails generate token_authenticate_me:install`
|
8
|
+
- Note: Patch version upgrades shouldnt need to run the install command.
|
9
|
+
|
10
|
+
## Getting Started
|
7
11
|
|
8
12
|
Add the gem to your Gemfile:
|
9
13
|
`gem token_authenticate_me`
|
@@ -10,7 +10,7 @@ module TokenAuthenticateMe
|
|
10
10
|
has_secure_password validations: false
|
11
11
|
attr_accessor :current_password
|
12
12
|
|
13
|
-
has_many :sessions
|
13
|
+
has_many :sessions, dependent: :destroy
|
14
14
|
has_many :invites, inverse_of: 'creator', foreign_key: 'creator_id'
|
15
15
|
|
16
16
|
validates(
|
@@ -76,8 +76,9 @@ module TokenAuthenticateMe
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def current_password_correct
|
79
|
+
user_with_old_password = self.class.find_by_id(id)
|
79
80
|
errors.add(:current_password, 'is required to change email and/or password') if current_password.blank? # rubocop:disable Metrics/LineLength
|
80
|
-
errors.add(:current_password, 'is incorrect') unless authenticate(current_password)
|
81
|
+
errors.add(:current_password, 'is incorrect') unless user_with_old_password.authenticate(current_password)
|
81
82
|
end
|
82
83
|
|
83
84
|
def current_password_required?
|
File without changes
|
File without changes
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: token_authenticate_me
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Clopton
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2017-
|
12
|
+
date: 2017-07-05 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rails
|
@@ -105,6 +105,7 @@ files:
|
|
105
105
|
- db/migrate/20160620184327_create_token_authenticate_me_invites.rb
|
106
106
|
- db/migrate/20160621211347_create_token_authenticate_me_users.rb
|
107
107
|
- db/migrate/20160622203801_create_token_authenticate_me_sessions.rb
|
108
|
+
- db/migrate/20170629224206_add_index_to_users.rb
|
108
109
|
- lib/generators/token_authenticate_me/controllers/controllers_generator.rb
|
109
110
|
- lib/generators/token_authenticate_me/install/install_generator.rb
|
110
111
|
- lib/generators/token_authenticate_me/models/models_generator.rb
|
@@ -162,6 +163,8 @@ files:
|
|
162
163
|
- test/dummy/config/locales/en.yml
|
163
164
|
- test/dummy/config/routes.rb
|
164
165
|
- test/dummy/config/secrets.yml
|
166
|
+
- test/dummy/log/development.log
|
167
|
+
- test/dummy/log/test.log
|
165
168
|
- test/dummy/public/404.html
|
166
169
|
- test/dummy/public/422.html
|
167
170
|
- test/dummy/public/500.html
|
@@ -228,6 +231,8 @@ test_files:
|
|
228
231
|
- test/dummy/config/routes.rb
|
229
232
|
- test/dummy/config/secrets.yml
|
230
233
|
- test/dummy/config.ru
|
234
|
+
- test/dummy/log/development.log
|
235
|
+
- test/dummy/log/test.log
|
231
236
|
- test/dummy/public/404.html
|
232
237
|
- test/dummy/public/422.html
|
233
238
|
- test/dummy/public/500.html
|