challah 1.6.0 → 1.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 0c5d55264692dddf543d5c67c2590a56ca95ba7e
4
- data.tar.gz: f1c1b7db86c25987bc4ec369a9928a6ff6a2043a
2
+ SHA256:
3
+ metadata.gz: 52c23a580c2dfe4d78653d75a44f1a1f5f0c54b3d62c7091ce0089621e35add4
4
+ data.tar.gz: 839e41cf3038d7e8319d476268abad5004a8adbbedcf5eba2fbb1119ddef9b23
5
5
  SHA512:
6
- metadata.gz: 66d518430ab8db7e27eb0bfd6ef23681b7d49af39eb20baf77c88b1ae6d403db85e4a972e0b852e9408800e9dba5323a345d9fff85c3930d5025a87c730d53ae
7
- data.tar.gz: 272d606557225f242aa605c09e4ac76a62d5e19e8672b0861abe71a2eee10c97c55a48958b7468f25d0876f6370ed864ad99379561238860188357816e2c7091
6
+ metadata.gz: f91ad595ae383d6775e533f1cc60053be1221d824ff351b6ea6f24a22eed1e9ea6ff3172f82f6930a7aa522e6e910d0bb3b0e3a86a457a5e5d79368196c86938
7
+ data.tar.gz: c5b43537d21543b4d9d3eb2aa3791b669c9d91c26050f4211a07c5bf7bea5f5b9f5081e0de239fb8519cef8c61fdba3e9a05bbf18ec2c5a2a3341b86011af93a
@@ -1,3 +1,8 @@
1
+ ## Challah 1.6.1
2
+
3
+ * Prevent an email address that is blank from saving the `User#email_hash` attribute
4
+ * Removes default column for `last_session_ip` that unnecessarily stores user IP addresses by default and could be considered a privacy concern. This column can be manually included in the migration to still track the user IP.
5
+
1
6
  ## Challah 1.6.0
2
7
 
3
8
  * For token technique, don't bother checking the database for an empty token query param
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Challah
2
2
 
3
- [![Build Status](https://travis-ci.org/jdtornow/challah.svg?branch=master)](https://travis-ci.org/jdtornow/challah) [![Code Climate](https://codeclimate.com/github/jdtornow/challah/badges/gpa.svg)](https://codeclimate.com/github/jdtornow/challah) [![Dependency Status](https://gemnasium.com/jdtornow/challah.svg)](https://gemnasium.com/jdtornow/challah) [![Gem Version](https://badge.fury.io/rb/challah.svg)](https://badge.fury.io/rb/challah)
3
+ [![Build Status](https://travis-ci.org/jdtornow/challah.svg?branch=master)](https://travis-ci.org/jdtornow/challah) [![Code Climate](https://codeclimate.com/github/jdtornow/challah/badges/gpa.svg)](https://codeclimate.com/github/jdtornow/challah) [![Gem Version](https://badge.fury.io/rb/challah.svg)](https://badge.fury.io/rb/challah)
4
4
 
5
5
  Challah (pronounced HAH-lah) is a simple Rails authentication gem that provides users a way to authenticate with your app. Most of the functionality within the gem lives within a Rails engine and tries to stay out of the way of your app.
6
6
 
@@ -10,7 +10,7 @@ Challah doesn't provide any fancy controllers or views that clutter your app or
10
10
 
11
11
  * Ruby 2.2.2+
12
12
  * Bundler
13
- * Rails 5.0+ (4.2 still supported, but not recommended)
13
+ * Rails 5.0+
14
14
 
15
15
  ## Installation
16
16
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.6.0
1
+ 1.6.1
@@ -50,7 +50,7 @@ module Challah
50
50
  def ensure_email_hash_presence
51
51
  if respond_to?("email_hash=")
52
52
  if email_changed?
53
- self.email_hash = Encrypter.md5(email.to_s.downcase.strip)
53
+ self.email_hash = generate_email_hash
54
54
  end
55
55
  end
56
56
  end
@@ -64,6 +64,12 @@ module Challah
64
64
  end
65
65
  end
66
66
 
67
+ def generate_email_hash
68
+ if self.email.present?
69
+ Encrypter.md5(email.to_s.downcase.strip)
70
+ end
71
+ end
72
+
67
73
  # Downcase email and strip if of whitespace
68
74
  # Ex: " HELLO@example.com " => "hello@example.com"
69
75
  def normalize_user_email
@@ -35,9 +35,9 @@ module Challah
35
35
  # been authenticated.
36
36
  def successful_authentication!(ip_address = nil)
37
37
  self.last_session_at = Time.now
38
- self.last_session_ip = ip_address
38
+ self.last_session_ip = ip_address if respond_to?(:last_session_ip=)
39
39
  self.save
40
40
  self.increment!(:session_count, 1)
41
41
  end
42
42
  end
43
- end
43
+ end
@@ -8,7 +8,6 @@ class ChallahCreateUsers < ActiveRecord::Migration<%= migration_version %>
8
8
  t.string :persistence_token
9
9
  t.string :api_key
10
10
  t.datetime :last_session_at
11
- t.string :last_session_ip
12
11
  t.integer :session_count, default: 0
13
12
  t.integer :failed_auth_count, default: 0
14
13
  t.integer :created_by, default: 0
@@ -31,7 +30,6 @@ class ChallahCreateUsers < ActiveRecord::Migration<%= migration_version %>
31
30
  t.string :token, limit: 500
32
31
  t.datetime :expires_at
33
32
  t.datetime :last_session_at
34
- t.string :last_session_ip
35
33
  t.integer :session_count, default: 0
36
34
  t.timestamps null: true
37
35
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: challah
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.6.0
4
+ version: 1.6.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - John Tornow
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-12-20 00:00:00.000000000 Z
13
+ date: 2018-08-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: highline
@@ -116,6 +116,20 @@ dependencies:
116
116
  - - "~>"
117
117
  - !ruby/object:Gem::Version
118
118
  version: '1.3'
119
+ - !ruby/object:Gem::Dependency
120
+ name: rspec_junit_formatter
121
+ requirement: !ruby/object:Gem::Requirement
122
+ requirements:
123
+ - - "~>"
124
+ - !ruby/object:Gem::Version
125
+ version: '0.2'
126
+ type: :development
127
+ prerelease: false
128
+ version_requirements: !ruby/object:Gem::Requirement
129
+ requirements:
130
+ - - "~>"
131
+ - !ruby/object:Gem::Version
132
+ version: '0.2'
119
133
  description: A simple gem for authorization and session management in Rails.
120
134
  email:
121
135
  - john@johntornow.com
@@ -194,7 +208,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
194
208
  version: 1.8.11
195
209
  requirements: []
196
210
  rubyforge_project:
197
- rubygems_version: 2.5.2
211
+ rubygems_version: 2.7.6
198
212
  signing_key:
199
213
  specification_version: 4
200
214
  summary: Rails authentication and sessions