leveret_auth 0.0.1 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/devise/models/auth_identitable.rb +3 -2
- data/lib/leveret_auth/config.rb +7 -12
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 223d6b305ce103126d12304117c3f7bebeead95d4551284ce73e952bb1044a47
|
4
|
+
data.tar.gz: a6b1bf2670366abb148566ad78a89a64cef6fa75c235e57aa90d5ef8d67f7f77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 45e9c32e370313058d194bd95861bb23984bc06513b595faf75b96d23945f9e63e13a9231affd0a97d6719a276279a6bb27df7fc7768343a100d7899a2a6bfdc
|
7
|
+
data.tar.gz: 856aeffe7565dbf3277b929ab22ca1e295242ef47cc989b1c5e3dd880fad1eb430986dd65175adb36ee85319a388b09cd07e01ba288874ae26ad26b6ea052db1
|
@@ -17,7 +17,7 @@ module Devise
|
|
17
17
|
identity = LeveretAuth::Identities.find_or_initialize_by(uid: uid, provider: provider)
|
18
18
|
return identity.user unless identity.new_record?
|
19
19
|
|
20
|
-
identity.user = setup_with_temporary_passsword(email)
|
20
|
+
identity.user = setup_with_temporary_passsword(email, &LeveretAuth.configuration.before_user_save)
|
21
21
|
identity.save!
|
22
22
|
identity.user
|
23
23
|
end
|
@@ -28,8 +28,9 @@ module Devise
|
|
28
28
|
user = find_or_initialize_by(email: email)
|
29
29
|
user unless user.new_record?
|
30
30
|
|
31
|
-
user.password =
|
31
|
+
user.password = SecureRandom.hex(16)
|
32
32
|
user.skip_confirmation!
|
33
|
+
yield user if block_given?
|
33
34
|
user.save!
|
34
35
|
user
|
35
36
|
end
|
data/lib/leveret_auth/config.rb
CHANGED
@@ -42,12 +42,12 @@ module LeveretAuth
|
|
42
42
|
@user_model_name.to_s.classify
|
43
43
|
end
|
44
44
|
|
45
|
-
def
|
46
|
-
@
|
45
|
+
def before_user_save
|
46
|
+
@before_user_save
|
47
47
|
end
|
48
48
|
|
49
|
-
def
|
50
|
-
@
|
49
|
+
def user_model
|
50
|
+
@user_model ||= user_model_name.constantize
|
51
51
|
end
|
52
52
|
|
53
53
|
def identities_model
|
@@ -66,19 +66,14 @@ module LeveretAuth
|
|
66
66
|
@config
|
67
67
|
end
|
68
68
|
|
69
|
-
def validate
|
70
|
-
if @config.user_default_password.nil?
|
71
|
-
raise ArgumentError,
|
72
|
-
'Must configure user default password by call `user_default_password password`'
|
73
|
-
end
|
74
|
-
end
|
69
|
+
def validate; end
|
75
70
|
|
76
71
|
def devise_for(model_name)
|
77
72
|
@config.instance_variable_set(:@user_model_name, model_name)
|
78
73
|
end
|
79
74
|
|
80
|
-
def
|
81
|
-
@config.instance_variable_set(:@
|
75
|
+
def before_user_save(&block)
|
76
|
+
@config.instance_variable_set(:@before_user_save, block) if block_given?
|
82
77
|
end
|
83
78
|
|
84
79
|
def add_provider(name, **opts)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: leveret_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ChengChih Chang
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-11-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-ldap
|
@@ -28,14 +28,14 @@ dependencies:
|
|
28
28
|
name: devise
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: 4.8.1
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: 4.8.1
|
41
41
|
description: auth with different strategy
|