nyauth 0.7.0 → 0.7.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f36d29cbcc92d7492f72e337dee64bbfe33a9666
|
4
|
+
data.tar.gz: 05e5541213f6de68c1dd6af716fba67dfb399f5b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 600804a6b8d4f09ebb1e9f6b448257ea8a6f2a5e43eb7d6349ecd7914ab616fe0fca9202611cd15855754e4c060c158d1ad7625fd29376fe197e336186793cf1
|
7
|
+
data.tar.gz: 78e26daa669e47d6c64daa9b21ce1859bcd55e1f908f26b0005a3bb3ad78a28f5515cc3980a7ebe9934abc20b6aafde5cfabc5dea240a59b84c4bafb23dad3aa
|
@@ -8,7 +8,6 @@ module Nyauth
|
|
8
8
|
|
9
9
|
def update
|
10
10
|
@client.attributes = client_params
|
11
|
-
@client.password_digest_will_change! # HACK for Rails5beta2 https://github.com/rails/rails/issues/23645
|
12
11
|
@client.save(context: :update_password)
|
13
12
|
respond_with(@client, location: Nyauth.configuration.redirect_path_after_update_password.call(nyauth_client_name) || main_app.root_path)
|
14
13
|
end
|
@@ -6,15 +6,22 @@ module Nyauth
|
|
6
6
|
|
7
7
|
included do
|
8
8
|
validates :email, presence: true
|
9
|
+
scope :with_given_email, -> (given_email) {
|
10
|
+
where(email: given_email)
|
11
|
+
}
|
9
12
|
end
|
10
13
|
|
11
14
|
module ClassMethods
|
12
15
|
def authenticate(given_email, given_password)
|
13
|
-
record =
|
16
|
+
record = candidate_for_authentication(given_email)
|
14
17
|
return nil unless record
|
15
18
|
|
16
19
|
record.verify_password?(given_password) ? record : nil
|
17
20
|
end
|
21
|
+
|
22
|
+
def candidate_for_authentication(given_email)
|
23
|
+
with_given_email(given_email).last
|
24
|
+
end
|
18
25
|
end
|
19
26
|
end
|
20
27
|
end
|
@@ -10,7 +10,7 @@ module Nyauth
|
|
10
10
|
def save(options = {})
|
11
11
|
options.reverse_merge!(as: :user)
|
12
12
|
klass = options[:as].to_s.classify.constantize
|
13
|
-
@client = klass.
|
13
|
+
@client = klass.with_given_email(@email).last!
|
14
14
|
@client.request_confirmation
|
15
15
|
rescue
|
16
16
|
errors.add(:base, :invalid_email)
|
@@ -10,7 +10,7 @@ module Nyauth
|
|
10
10
|
def save(options = {})
|
11
11
|
options.reverse_merge!(as: :user)
|
12
12
|
klass = options[:as].to_s.classify.constantize
|
13
|
-
@client = klass.
|
13
|
+
@client = klass.with_given_email(@email).last!
|
14
14
|
@client.request_reset_password
|
15
15
|
rescue
|
16
16
|
errors.add(:base, :invalid_email)
|
data/lib/nyauth/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nyauth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.7.
|
4
|
+
version: 0.7.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ppworks
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-06-
|
11
|
+
date: 2016-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|