minimalist_authentication 2.1.4 → 2.2.2

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
  SHA256:
3
- metadata.gz: f7b87a8cef7609390ef22d26995cb8ee9acca53ad0307c03ce7d83851411b6f4
4
- data.tar.gz: 5ca3252dc0515e323ae37de9658224629182bf5c8c0aa9c18f11d400b802c046
3
+ metadata.gz: d04ae5c32012e31770d8993023ef3d68e109118249bd91031b0888bc06cc9c87
4
+ data.tar.gz: f115956d42f256ddafd2f1328c688ba3a72a2e447a4bd34a182e1034d0df9d29
5
5
  SHA512:
6
- metadata.gz: a095c584ebc5b2dac48db94956cccce2057d845f640888d5b9ddca1566dbfcc84c239104043ee91cdf8495bf8120e23c12d179a03664e6aefcd00eb5367f82f4
7
- data.tar.gz: 2bdab56fcaf45777c4330f3bc45cac2bbc9981d3fda5209fed92702805d44f9de7918d846dda787902448a7e5a234aa8681407f67849cd602b0e47c6080b645a
6
+ metadata.gz: 43a655bede1179250c8f43410b239a4ae23ca07a80a0e7c2e65f0903ea9bf07772565026dc7b254c116f42682572a305e7bcd21a35a1049bde548fb48adddb99
7
+ data.tar.gz: dbf795a8be4b6fe6e6fc6f10b17f7d12587aa15db58232f4d3bd87c985ce4f7a9d43cbe5b8d9451b227524ce477597b8f0d1bec67e24e94d374f57e769923bf0
data/README.md CHANGED
@@ -147,4 +147,4 @@ When the conversion is complete the **crypted_password**, **salt**, and
147
147
 
148
148
 
149
149
  ## License
150
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
150
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT)..
@@ -3,7 +3,7 @@ class EmailsController < ApplicationController
3
3
  end
4
4
 
5
5
  def update
6
- if current_user.update_attributes(user_params)
6
+ if current_user.update(user_params)
7
7
  redirect_to update_redirect_path, notice: 'Email successfully updated'
8
8
  else
9
9
  render :edit
@@ -20,9 +20,9 @@ module MinimalistAuthentication
20
20
  before_save :hash_password
21
21
 
22
22
  # Email validations
23
- validates_presence_of :email, if: :validate_email_presence?
24
- validates_uniqueness_of :email, allow_blank: true, if: :validate_email?
25
- validates_format_of :email, allow_blank: true, with: EMAIL_REGEX, if: :validate_email?
23
+ validates_presence_of :email, if: :validate_email_presence?
24
+ validates_uniqueness_of :email, allow_blank: true, case_sensitive: false, if: :validate_email?
25
+ validates_format_of :email, allow_blank: true, with: EMAIL_REGEX, if: :validate_email?
26
26
 
27
27
  # Password validations
28
28
  validates_presence_of :password, if: :validate_password?
@@ -30,16 +30,17 @@ module MinimalistAuthentication
30
30
  validates_length_of :password, within: PASSWORD_MIN..PASSWORD_MAX, if: :validate_password?
31
31
 
32
32
  # Active scope
33
- scope :active, ->(active = true) { where active: active }
33
+ scope :active, ->(state = true) { where(active: state) }
34
+ scope :inactive, -> { active(false) }
34
35
  end
35
36
 
36
37
  module ClassMethods
37
38
  # Authenticates a user form the params provided. Expects a params hash with
38
- # email or username and passwod keys.
39
+ # email or username and password keys.
39
40
  # Params examples:
40
41
  # { email: 'user@example.com', password: 'abc123' }
41
42
  # { username: 'user', password: 'abc123' }
42
- # Returns user upon successful authentcation.
43
+ # Returns user upon successful authentication.
43
44
  # Otherwise returns nil.
44
45
  def authenticate(params)
45
46
  # extract email or username and the associated value
@@ -65,6 +66,11 @@ module MinimalistAuthentication
65
66
  active
66
67
  end
67
68
 
69
+ # Returns true if the user is not active.
70
+ def inactive?
71
+ !active
72
+ end
73
+
68
74
  # Return true if password matches the hashed_password.
69
75
  # If successful checks for an outdated password_hash and updates if
70
76
  # necessary.
@@ -107,7 +113,7 @@ module MinimalistAuthentication
107
113
  Password.new(password_hash)
108
114
  end
109
115
 
110
- # Requre password for active users that either do no have a password hash
116
+ # Require password for active users that either do no have a password hash
111
117
  # stored OR are attempting to set a new password. Set **password_required**
112
118
  # to true to force validations even when the password field is blank.
113
119
  def validate_password?
@@ -122,7 +128,7 @@ module MinimalistAuthentication
122
128
  end
123
129
 
124
130
  # Validate email presence for active users.
125
- # Applications can turn offf email presence validation by setting
131
+ # Applications can turn off email presence validation by setting
126
132
  # validate_email_presence configuration attribute to false.
127
133
  def validate_email_presence?
128
134
  MinimalistAuthentication.configuration.validate_email_presence && validate_email?
@@ -19,7 +19,7 @@ module MinimalistAuthentication
19
19
  end
20
20
 
21
21
  def matches_verification_token?(token)
22
- verification_token_valid? && secure_match?(token)
22
+ token.present? && verification_token_valid? && secure_match?(token)
23
23
  end
24
24
 
25
25
  def verification_token_valid?
@@ -1,3 +1,3 @@
1
1
  module MinimalistAuthentication
2
- VERSION = '2.1.4'
2
+ VERSION = '2.2.2'
3
3
  end
metadata CHANGED
@@ -1,28 +1,28 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: minimalist_authentication
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.4
4
+ version: 2.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aaron Baldwin
8
8
  - Brightways Learning
9
- autorequire:
9
+ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2019-04-25 00:00:00.000000000 Z
12
+ date: 2021-08-31 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - "~>"
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '5.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - "~>"
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '5.0'
28
28
  - !ruby/object:Gem::Dependency
@@ -110,7 +110,7 @@ homepage: https://github.com/wwidea/minimalist_authentication
110
110
  licenses:
111
111
  - MIT
112
112
  metadata: {}
113
- post_install_message:
113
+ post_install_message:
114
114
  rdoc_options: []
115
115
  require_paths:
116
116
  - lib
@@ -125,9 +125,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
125
125
  - !ruby/object:Gem::Version
126
126
  version: '0'
127
127
  requirements: []
128
- rubyforge_project:
129
- rubygems_version: 2.7.7
130
- signing_key:
128
+ rubygems_version: 3.2.26
129
+ signing_key:
131
130
  specification_version: 4
132
131
  summary: A Rails authentication plugin that takes a minimalist approach.
133
132
  test_files: []