card-mod-account 0.11.0 → 0.11.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/set/all/account.rb +7 -5
  3. data/set/self/signin.rb +14 -27
  4. metadata +10 -10
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 446ac1cbd57b9473bffdf6fdb91303bc86cbcdcf584e2fafe48fc306da050580
4
- data.tar.gz: eecb9da6a9312154ec015ac20353061b8d2839a6c61d2dacabe9c2d3377603b9
3
+ metadata.gz: e8c86e418e23551b4e344d47073a5cea56789cab7a091d0ece4d6b7488bfe4fe
4
+ data.tar.gz: 1a18cfb82d88f0bcca51ec77b99237bbe4c5527db7bb527fbcaeff0d87338863
5
5
  SHA512:
6
- metadata.gz: 9472b1ed791997464de8a57adad65d83b9021df74750f76edaab8fddfb51df493801f659c861a870ae29994e806add8add7e8aa8f07c73954b159f9e288ed050
7
- data.tar.gz: 8525e80cacd92f2d5c7ce960bbdda0be8fc63441fb3cb408080bbf03a0d9fe2c302da16ab60b117c923d5141bd1a62611e3bc48ad61cc677c6ac62729b1bce36
6
+ metadata.gz: c7103bb8aea180221f488ed16dfce14862f7d4d7228110177a9d9b0423144220c383c1c4ec7b1651f07f997b5440cf49c5378cc377df8497ba6240ca38c44548
7
+ data.tar.gz: 04bc2d61a8f17c24f2d6d1aa06eb7aa978afd78a70593007e27a25bfeb247e869f43f4bccd46d203ebbe93cfa08f2377864bdb7bb2c04e285e2a30a08bd32d9c
data/set/all/account.rb CHANGED
@@ -63,15 +63,17 @@ def all_roles
63
63
  end
64
64
 
65
65
  def enabled_role_ids
66
- Auth.as_bot do
67
- # workaround for broken migrations
68
- return fetch_roles unless Card::Codename.exists? :enabled_roles
69
-
70
- enabled = enabled_roles_card
66
+ with_enabled_roles do |enabled|
71
67
  enabled.virtual? ? enabled.item_ids : fetch_roles
72
68
  end
73
69
  end
74
70
 
71
+ def with_enabled_roles
72
+ Auth.as_bot do
73
+ Card::Codename.exists?(:enabled_roles) ? yield(enabled_roles_card) : fetch_roles
74
+ end
75
+ end
76
+
75
77
  def enabled_roles_card
76
78
  fetch :enabled_roles, eager_cache: true, new: { type_id: SessionID }
77
79
  end
data/set/self/signin.rb CHANGED
@@ -30,8 +30,13 @@ end
30
30
  # triggered by clicking "Reset my Password", this sends out the verification password
31
31
  # and aborts (does not sign in)
32
32
  event :send_reset_password_token, before: :signin, on: :update, trigger: :required do
33
- email = subfield(:email)&.content
34
- send_reset_password_email_or_fail email
33
+ aborting do
34
+ blank_email? ? break : send_reset_password_email_or_fail
35
+ end
36
+ end
37
+
38
+ def email_from_subfield
39
+ @email_from_subfield ||= subfield(:email)&.content
35
40
  end
36
41
 
37
42
  def ok_to_read
@@ -83,34 +88,16 @@ def account_for email
83
88
  Auth.find_account_by_email email
84
89
  end
85
90
 
86
- def send_reset_password_email_or_fail email
87
- aborting do
88
- break errors.add :email, i18n_signin(:error_blank) if email.blank?
89
-
90
- if (account = Auth.find_account_by_email(email))&.active?
91
- Auth.as_bot { account.send_password_reset_email }
92
- elsif account
93
- errors.add :account, i18n_signin(:error_not_active)
94
- else
95
- errors.add :email, i18n_signin(:error_not_recognized)
96
- end
97
- end
98
- end
99
-
100
- def send_reset_password_email_or_fail email
101
- aborting do
102
- break if blank_email? email
103
-
104
- if (account = account_for email)&.active?
105
- send_reset_password_email account
106
- else
107
- reset_password_fail account
108
- end
91
+ def send_reset_password_email_or_fail
92
+ if (account = account_for email_from_subfield)&.active?
93
+ send_reset_password_email account
94
+ else
95
+ reset_password_fail account
109
96
  end
110
97
  end
111
98
 
112
- def blank_email? email
113
- return false if email.present?
99
+ def blank_email?
100
+ return false if email_from_subfield.present?
114
101
 
115
102
  error_on :email, :error_blank
116
103
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: card-mod-account
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.11.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ethan McCutchen
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-12-24 00:00:00.000000000 Z
13
+ date: 2021-03-02 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: card
@@ -18,56 +18,56 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 1.101.0
21
+ version: 1.101.1
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 1.101.0
28
+ version: 1.101.1
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: card-mod-email
31
31
  requirement: !ruby/object:Gem::Requirement
32
32
  requirements:
33
33
  - - '='
34
34
  - !ruby/object:Gem::Version
35
- version: 0.11.0
35
+ version: 0.11.1
36
36
  type: :runtime
37
37
  prerelease: false
38
38
  version_requirements: !ruby/object:Gem::Requirement
39
39
  requirements:
40
40
  - - '='
41
41
  - !ruby/object:Gem::Version
42
- version: 0.11.0
42
+ version: 0.11.1
43
43
  - !ruby/object:Gem::Dependency
44
44
  name: card-mod-permissions
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - '='
48
48
  - !ruby/object:Gem::Version
49
- version: 0.11.0
49
+ version: 0.11.1
50
50
  type: :runtime
51
51
  prerelease: false
52
52
  version_requirements: !ruby/object:Gem::Requirement
53
53
  requirements:
54
54
  - - '='
55
55
  - !ruby/object:Gem::Version
56
- version: 0.11.0
56
+ version: 0.11.1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: card-mod-list
59
59
  requirement: !ruby/object:Gem::Requirement
60
60
  requirements:
61
61
  - - '='
62
62
  - !ruby/object:Gem::Version
63
- version: 0.11.0
63
+ version: 0.11.1
64
64
  type: :runtime
65
65
  prerelease: false
66
66
  version_requirements: !ruby/object:Gem::Requirement
67
67
  requirements:
68
68
  - - '='
69
69
  - !ruby/object:Gem::Version
70
- version: 0.11.0
70
+ version: 0.11.1
71
71
  description: ''
72
72
  email:
73
73
  - info@decko.org