devise_pam_authenticatable2 6.0.0 → 6.1.0

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: 9612c985b409e41235b25bff4a0c9110aab3f632
4
- data.tar.gz: 9e2a2918a8de29a63d495efb211ce46074086767
2
+ SHA256:
3
+ metadata.gz: 5745cc55b3ccebdf26683d92c40f957763aa11427c857ae389c3a9ab4ff68f6b
4
+ data.tar.gz: a6fe0983a958d2e9bacd098d5896eba3af22f4fd7871c23e0f0aa69b335b8361
5
5
  SHA512:
6
- metadata.gz: 55ec5e1245044b87712279ce487134b5d17e71efe802f6f30301b067e997a2674b520fc6d7391bec42e4cb0246a194bd008ce01c3f3b6ca08684c708018cd6c7
7
- data.tar.gz: 7df42cbbc2df9263b44c829f784a4c6f5aa177841b5d8bd0b7014e9574db1583a1dc8b4eaf0cfd6d41a46db020f39351110262566f64475b10f97164b8b766e2
6
+ metadata.gz: 6ff5f1a174b2f0aed9022f6c9ba137fbaa98eec91c168a622773cd702a21b1e1e3092e287d4059961137f8ab7b4b8f246a945fd0bbefac88fa58fdb8a5d413a0
7
+ data.tar.gz: 28f19cf3c0d2db216d5671744d5ec8d885d7806b747718169f91db34d47f1f0d6c299a3a4beb03febef903c22a9b5b3533d9a79fd1399bdf8c3d4508cbfe9f54
data/VERSION CHANGED
@@ -1 +1 @@
1
- 6.0.0
1
+ 6.1.0
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: devise_pam_authenticatable2 6.0.0 ruby lib
5
+ # stub: devise_pam_authenticatable2 6.1.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "devise_pam_authenticatable2".freeze
9
- s.version = "6.0.0"
9
+ s.version = "6.1.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib".freeze]
@@ -62,8 +62,7 @@ module Devise
62
62
  module ClassMethods
63
63
  Devise::Models.config(self, :pam_service, :pam_suffix)
64
64
 
65
- def authenticate_with_pam(attributes = {})
66
- return nil unless attributes[:password]
65
+ def pam_find_user(attributes = {})
67
66
  if ::Devise.usernamefield && attributes[:username]
68
67
  resource = find_by(::Devise.usernamefield => attributes[:username])
69
68
 
@@ -71,9 +70,13 @@ module Devise
71
70
  resource = new
72
71
  resource[::Devise.usernamefield] = attributes[:username]
73
72
  end
74
- elsif ::Devise.emailfield
75
- return nil unless attributes[:email]
76
- resource = find_by(::Devise.emailfield => attributes[:email])
73
+ return resource
74
+ elsif ::Devise.emailfield && attributes[:email]
75
+ if ::Devise.check_at_sign && ::Devise.usernamefield && attributes[:email].index('@').nil?
76
+ resource = find_by(::Devise.usernamefield => attributes[:email])
77
+ else
78
+ resource = find_by(::Devise.emailfield => attributes[:email])
79
+ end
77
80
 
78
81
  if resource.blank?
79
82
  resource = new
@@ -84,9 +87,14 @@ module Devise
84
87
  resource[::Devise.emailfield] = attributes[:email]
85
88
  end
86
89
  end
87
- else
88
- return nil
90
+ return resource
89
91
  end
92
+ end
93
+
94
+ def authenticate_with_pam(attributes = {})
95
+ return nil unless attributes[:password]
96
+
97
+ return nil unless (resource = pam_find_user(attributes))
90
98
 
91
99
  # potential conflict detected
92
100
  resource = resource.pam_conflict(attributes) if resource.pam_conflict?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: devise_pam_authenticatable2
3
3
  version: !ruby/object:Gem::Version
4
- version: 6.0.0
4
+ version: 6.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Wilson
@@ -75,7 +75,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
75
75
  version: '0'
76
76
  requirements: []
77
77
  rubyforge_project:
78
- rubygems_version: 2.6.13
78
+ rubygems_version: 2.7.3
79
79
  signing_key:
80
80
  specification_version: 4
81
81
  summary: Devise PAM authentication module using rpam2