card-mod-account 0.14.2 → 0.15.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/assets/style/account.scss +56 -0
- data/{locales → config/locales}/de.yml +3 -6
- data/{locales → config/locales}/en.yml +1 -2
- data/data/real.yml +300 -0
- data/db/migrate_core_cards/20220815112551_move_roles.rb +47 -0
- data/set/abstract/account_field.rb +1 -3
- data/set/abstract/accountable.rb +1 -1
- data/set/all/account.rb +4 -7
- data/set/right/account/events.rb +3 -3
- data/set/right/account/views.rb +2 -1
- data/set/right/account.rb +1 -3
- data/set/right/email.rb +3 -1
- data/set/right/password.rb +2 -0
- data/set/right/roles.rb +5 -23
- data/set/right/salt.rb +2 -0
- data/set/right/status.rb +4 -2
- data/set/self/role.rb +38 -0
- data/set/self/signin/core.haml +10 -0
- data/set/self/signin.rb +16 -23
- data/set/type/role.rb +3 -1
- data/set/type/signup/views.rb +5 -4
- data/set/type/signup.rb +5 -3
- data/set/type/user/setup_help.haml +1 -1
- data/set/type/user.rb +8 -3
- data/set/type_plus_right/role/members.rb +5 -0
- data/set/type_plus_right/user/email.rb +4 -0
- metadata +48 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7b83b1dace27f150876facb4ed43c0a10d8ec9bece44db60bf1f9d72a5a5077f
|
4
|
+
data.tar.gz: b2a168fb461984653318cddd41107ecdf05daa26711677ee0ba3feee4200f530
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c9a9d6bfcddf2b26f682fa266ead5c99d9834dc39475c9e19c106b573086c8a787f3a0ad25e9da552f365a54759a841d187e4e8a371e22d242508aacb8955be1
|
7
|
+
data.tar.gz: 51ec9397ba5326df51c94f4e73c378b58d273a23ca3d2a74b1b1f8c55b16f1a003ce53c2598fff1a4c0c159302f62c8b8afc34608c529ed104ad968cf72dec78
|
@@ -0,0 +1,56 @@
|
|
1
|
+
/*----------- (Account Request)--------------*/
|
2
|
+
|
3
|
+
.SELF-Xsignin {
|
4
|
+
> .d0-card-body {
|
5
|
+
display: flex;
|
6
|
+
justify-content: center;
|
7
|
+
> .card-form {
|
8
|
+
width: 400px;
|
9
|
+
max-width: 400px;
|
10
|
+
}
|
11
|
+
.signin-buttons > div {
|
12
|
+
margin-bottom: 1em;
|
13
|
+
button {
|
14
|
+
width: 100%
|
15
|
+
}
|
16
|
+
}
|
17
|
+
.signup-button {
|
18
|
+
text-align: center;
|
19
|
+
}
|
20
|
+
}
|
21
|
+
}
|
22
|
+
|
23
|
+
.invite-links {
|
24
|
+
padding: 10px;
|
25
|
+
margin-top: 10px;
|
26
|
+
text-align: center;
|
27
|
+
a {
|
28
|
+
font-weight: bold;
|
29
|
+
margin: 0 20px;
|
30
|
+
}
|
31
|
+
}
|
32
|
+
|
33
|
+
/*-- sign in page --*/
|
34
|
+
|
35
|
+
#sign-in input#login_field,
|
36
|
+
#sign-in input#password,
|
37
|
+
#forgot-password input#email {
|
38
|
+
width: 50%;
|
39
|
+
}
|
40
|
+
|
41
|
+
#forgot-password {
|
42
|
+
margin-top: 40px;
|
43
|
+
}
|
44
|
+
|
45
|
+
.new-account-link {
|
46
|
+
text-align: center;
|
47
|
+
}
|
48
|
+
|
49
|
+
.form-group .signup-link {
|
50
|
+
display: inline;
|
51
|
+
}
|
52
|
+
|
53
|
+
// FIXME - decko should handle better
|
54
|
+
//#my-card-link {
|
55
|
+
// padding-right: 0.6em;
|
56
|
+
//}
|
@@ -41,10 +41,8 @@
|
|
41
41
|
or_sign_up: '...oder registrieren!'
|
42
42
|
reset_password: PASSWORT ZURÜCKSETZEN
|
43
43
|
forgot_password: Passwort vergessen
|
44
|
-
reset_my_password: Setze mein Passwort zurück
|
45
44
|
check_email: Sie erhalten in Kürze eine E-Mail mit einem Link um ihr Passwort zurück zu setzen.
|
46
45
|
error_unknown_email: Unbekannte E-Mail-Adresse.
|
47
|
-
error_not_active: Entschuldigung, der Account ist nicht aktiviert.
|
48
46
|
error_wrong_password: Falsches Passwort
|
49
47
|
error_blank: fehlt
|
50
48
|
email_missing: E-Mail-Addresse fehlt
|
@@ -86,7 +84,7 @@ de:
|
|
86
84
|
account_deny_email_restricted: E-Mail-Adresse ist nur für Administratoren und Kontoinhaber
|
87
85
|
account_deny_not_change_own_account: den Status des eigenen Kontos ändern
|
88
86
|
account_email_missing: E-Mail darf nicht frei bleiben
|
89
|
-
account_encrypted:
|
87
|
+
account_encrypted: verschlüsselt
|
90
88
|
account_error_blank: darf nicht frei bleiben
|
91
89
|
account_error_invalid_address: muss eine gültige Adresse sein
|
92
90
|
account_error_not_active: Sorry, dieses Konto ist nicht aktiviert
|
@@ -103,12 +101,11 @@ de:
|
|
103
101
|
account_password_length: muss mindestens 4 Zeichen lang sein
|
104
102
|
account_password_missing: Passwort muss angegeben werden
|
105
103
|
account_private_data: Private Daten
|
106
|
-
|
107
|
-
account_reset_password: PASSWORT ZURÜCKSETZEN
|
104
|
+
account_reset_password: Password Zurücksetzen
|
108
105
|
account_search_email_duplicate: E-Mail-Duplikat? (%{content})
|
109
106
|
account_sign_in: Anmelden
|
110
107
|
account_sign_in_title: Anmelden
|
111
108
|
account_sign_out: Abmelden
|
112
109
|
account_sign_up: Registrieren
|
113
110
|
account_sorry_email_reset:
|
114
|
-
Sorry, %{error_msg}. Bitte prüfen Sie Ihre E-Mail auf einen neuen Link zum Zurücksetzen des Passworts.
|
111
|
+
Sorry, %{error_msg}. Bitte prüfen Sie Ihre E-Mail auf einen neuen Link zum Zurücksetzen des Passworts.
|
@@ -20,8 +20,7 @@ en:
|
|
20
20
|
account_password_length: must be at least 4 characters
|
21
21
|
account_password_missing: password can't be blank
|
22
22
|
account_private_data: Private data
|
23
|
-
|
24
|
-
account_reset_password: RESET PASSWORD
|
23
|
+
account_reset_password: Reset password
|
25
24
|
account_search_email_duplicate: email duplicate? (%{content})
|
26
25
|
account_sign_in: Sign in
|
27
26
|
account_sign_in_title: Sign In
|
data/data/real.yml
ADDED
@@ -0,0 +1,300 @@
|
|
1
|
+
---
|
2
|
+
# Cardtypes
|
3
|
+
|
4
|
+
- :name: Role
|
5
|
+
:type: :cardtype
|
6
|
+
:codename: role
|
7
|
+
:fields:
|
8
|
+
:description: |-
|
9
|
+
Each [[user]] can be given roles to organize site permissions.
|
10
|
+
[[http://decko.org/Role|Learn more about roles]].
|
11
|
+
|
12
|
+
- :name: "*members"
|
13
|
+
:codename: members
|
14
|
+
|
15
|
+
|
16
|
+
# Roles
|
17
|
+
|
18
|
+
- :name: Anyone
|
19
|
+
:type: :role
|
20
|
+
:codename: anyone
|
21
|
+
:fields:
|
22
|
+
:description: |-
|
23
|
+
Everyone has this role, whether signed in or not. [[http://decko.org/account|more]]
|
24
|
+
- :name: Anyone Signed In
|
25
|
+
:type: :role
|
26
|
+
:codename: anyone_signed_in
|
27
|
+
:fields:
|
28
|
+
:description: |-
|
29
|
+
Anyone who is signed in has this role. [[http://decko.org/account|more]]
|
30
|
+
- :name: Administrator
|
31
|
+
:type: :role
|
32
|
+
:codename: administrator
|
33
|
+
:fields:
|
34
|
+
:description: |-
|
35
|
+
[[_left+:members|Administrators]] can create, read, update and delete any card.
|
36
|
+
[[http://decko.org/permissions|more]]
|
37
|
+
:members:
|
38
|
+
:fields:
|
39
|
+
:self:
|
40
|
+
:fields:
|
41
|
+
:update: Administrator
|
42
|
+
- :name: Eagle
|
43
|
+
:type: :role
|
44
|
+
:codename: eagle
|
45
|
+
:fields:
|
46
|
+
:description: "[[Eagle+:members|Eagle users]] can add and edit content."
|
47
|
+
- :name: Shark
|
48
|
+
:type: :role
|
49
|
+
:codename: shark
|
50
|
+
:fields:
|
51
|
+
:description: |-
|
52
|
+
[[_left+:members|Shark users]] can configure the deck and create structures.
|
53
|
+
:members:
|
54
|
+
:fields:
|
55
|
+
:self:
|
56
|
+
:fields:
|
57
|
+
:update: Administrator
|
58
|
+
- :name: Help Desk
|
59
|
+
:type: :role
|
60
|
+
:codename: help_desk
|
61
|
+
:fields:
|
62
|
+
:description: |-
|
63
|
+
[[_left+*members|Help Desk users]] can manage accounts and edit help text.
|
64
|
+
:members:
|
65
|
+
:fields:
|
66
|
+
:self:
|
67
|
+
:fields:
|
68
|
+
:update: Administrator
|
69
|
+
- :name: Anonymous
|
70
|
+
:codename: anonymous
|
71
|
+
:content: "<p>Edits made by people who are not signed in are credited to Anonymous.
|
72
|
+
[[http://decko.org/account|Learn more about accounts]].</p>"
|
73
|
+
|
74
|
+
- :name:
|
75
|
+
- :role
|
76
|
+
- :members
|
77
|
+
- :type_plus_right
|
78
|
+
- :update
|
79
|
+
:content:
|
80
|
+
Help Desk
|
81
|
+
|
82
|
+
- :name: "*account"
|
83
|
+
:codename: account
|
84
|
+
:fields:
|
85
|
+
:right:
|
86
|
+
:fields:
|
87
|
+
:create: Administrator
|
88
|
+
:read: Help Desk
|
89
|
+
:update: Help Desk
|
90
|
+
:delete: Help Desk
|
91
|
+
:content: |-
|
92
|
+
<div>When someone signs up, they create a [[Sign up]] card...</div>
|
93
|
+
<blockquote>
|
94
|
+
<div>{{Sign up|closed;title: Sign ups}}</div>
|
95
|
+
</blockquote>
|
96
|
+
<div>...that can be changed into a [[User]] card:</div>
|
97
|
+
<blockquote>
|
98
|
+
<div>{{User|title: Users; closed}}</div>
|
99
|
+
</blockquote>
|
100
|
+
<div>Some important [[http://decko.org/permissions|permissions]]:</div>
|
101
|
+
<div>
|
102
|
+
<ul>
|
103
|
+
<li>When [[Anyone]] can [[*create|create]] a [[Sign up]] card, links to sign up will appear.</li>
|
104
|
+
<li>When [[Anyone]] can [[*create|create]] a [[User]] card, each [[Sign up]] can be auto-approved with a verification email.</li>
|
105
|
+
<li>If permission to [[*create|create]] a [[User]] is restricted, someone with that permission must approve each [[Sign up]] by hand.</li>
|
106
|
+
</ul>
|
107
|
+
</div>
|
108
|
+
<h5>Related links</h5>
|
109
|
+
<ul>
|
110
|
+
<li><em>[[http://decko.org/account | Accounts docs]]</em></li>
|
111
|
+
<li><em>[[Cards with accounts]]</em></li>
|
112
|
+
<li><em>[[:account+:right+:by_name|Account cards]]</em></li>
|
113
|
+
</ul>
|
114
|
+
|
115
|
+
# :account fields
|
116
|
+
|
117
|
+
- :name: "*email"
|
118
|
+
:codename: email
|
119
|
+
:fields:
|
120
|
+
:right:
|
121
|
+
:fields:
|
122
|
+
:update: Help Desk
|
123
|
+
:delete: Help Desk
|
124
|
+
:read: Help Desk
|
125
|
+
- :name: "*password"
|
126
|
+
:codename: password
|
127
|
+
:fields:
|
128
|
+
:right:
|
129
|
+
:fields:
|
130
|
+
:update: Help Desk
|
131
|
+
:delete: Help Desk
|
132
|
+
:read: Help Desk
|
133
|
+
- :name: "*salt"
|
134
|
+
:codename: salt
|
135
|
+
:fields:
|
136
|
+
:right:
|
137
|
+
:fields:
|
138
|
+
:read: Help Desk
|
139
|
+
- :name: "*status"
|
140
|
+
:codename: status
|
141
|
+
:fields:
|
142
|
+
:right:
|
143
|
+
:fields:
|
144
|
+
:update: Help Desk
|
145
|
+
:delete: Help Desk
|
146
|
+
:read: Help Desk
|
147
|
+
|
148
|
+
- :name: "*account settings"
|
149
|
+
:codename: account_settings
|
150
|
+
:fields:
|
151
|
+
:right:
|
152
|
+
:fields:
|
153
|
+
:structure: |-
|
154
|
+
{{_left+:account|content}}
|
155
|
+
{{_left+:roles|title: Roles}}
|
156
|
+
{{_left+:follow|title: Notification choices}}
|
157
|
+
|
158
|
+
- :name: Sign up
|
159
|
+
:type: :cardtype
|
160
|
+
:codename: signup
|
161
|
+
:fields:
|
162
|
+
:description: |-
|
163
|
+
[[Sign up]] cards represent not-yet-approved accounts.
|
164
|
+
When approved, they become [[User]] cards. [[http://decko.org/account|more]]
|
165
|
+
:self:
|
166
|
+
:fields:
|
167
|
+
:structure: |-
|
168
|
+
<p>{{+:description|content}}</p>
|
169
|
+
<h2>{{_self|name}} Cards</h2>
|
170
|
+
<blockquote><p>{{+:type+:by_name|content}}</p></blockquote>
|
171
|
+
:type:
|
172
|
+
:fields:
|
173
|
+
:create: Anyone
|
174
|
+
:on_create: signup alert email
|
175
|
+
:account:
|
176
|
+
:fields:
|
177
|
+
:type_plus_right:
|
178
|
+
:fields:
|
179
|
+
:create: _left
|
180
|
+
- :name:
|
181
|
+
- :user
|
182
|
+
- :account
|
183
|
+
- :type_plus_right
|
184
|
+
- :create
|
185
|
+
:content: _left
|
186
|
+
|
187
|
+
- :name:
|
188
|
+
- :wagn_bot
|
189
|
+
- :account
|
190
|
+
:fields:
|
191
|
+
:email: no-reply@decko.org
|
192
|
+
|
193
|
+
- :name: welcome email
|
194
|
+
:type: :email_template
|
195
|
+
:codename: welcome_email
|
196
|
+
- :name: verification email
|
197
|
+
:type: :email_template
|
198
|
+
:codename: verification_email
|
199
|
+
:fields:
|
200
|
+
:from: Decko Bot
|
201
|
+
:subject: verification link for {{:title|core}}
|
202
|
+
:html_message: |-
|
203
|
+
<div style="text-align:center">
|
204
|
+
<h1>Thank you for signing up with {{:title|core}}!</h1>
|
205
|
+
<p>
|
206
|
+
Please <a href="{{_|verify_url}}">follow this link</a>
|
207
|
+
to verify this email address and activate your account.
|
208
|
+
</p>
|
209
|
+
<p><em>Link will remain valid for {{_|verify_days}} days.</em></p>
|
210
|
+
</div>
|
211
|
+
:text_message: |+
|
212
|
+
Thank you for signing up with {{:title|core}}!
|
213
|
+
|
214
|
+
Please follow the link below to verify this email address and activate your account.
|
215
|
+
|
216
|
+
{{_|verify_url}}
|
217
|
+
(Link will remain valid for {{_|verify_days}} days.)
|
218
|
+
- :name: password reset email
|
219
|
+
:type: :email_template
|
220
|
+
:codename: password_reset_email
|
221
|
+
:fields:
|
222
|
+
:from: Decko Bot
|
223
|
+
:subject: reset password for {{:title|core}}
|
224
|
+
:text_message: "** Password reset for {{:title|core}} **\n\nSomeone – you, we hope –
|
225
|
+
asked to reset your password. Please follow this link...\n\n {{_|reset_password_url}}\n
|
226
|
+
\ \n...to update your account details.\n\n\n(Link will remain valid for {{_|reset_password_days}}
|
227
|
+
days.)\n\n"
|
228
|
+
:html_message: "<div style=\"text-align:center\">\n
|
229
|
+
<h1>Password reset for {{:title|core}}</h1>\n
|
230
|
+
\ \n <p>Someone – you, we hope – asked to reset your password.</p>\n \n <p>Please
|
231
|
+
<a href=\"{{_|reset_password_url}}\">follow this link</a> to update your account
|
232
|
+
details.</p>\n \n <p><em>Link will remain valid for {{_|reset_password_days}}
|
233
|
+
days.</em></p>\n</div>\n\n"
|
234
|
+
- :name: signup alert email
|
235
|
+
:type: :email_template
|
236
|
+
:codename: signup_alert_email
|
237
|
+
:fields:
|
238
|
+
:from: _user
|
239
|
+
:subject: "{{_|name}} signed up for {{:title|core}}"
|
240
|
+
:text_message: |
|
241
|
+
{{_|name}} has signed up on {{:title|core}}.
|
242
|
+
|
243
|
+
See {{_|name}}'s card: {{_|url}}
|
244
|
+
|
245
|
+
-- the machines running {{:title|core}}
|
246
|
+
:html_message: |
|
247
|
+
<p>
|
248
|
+
{{_|name}}
|
249
|
+
has <a href="{{_|url}}">signed up</a>
|
250
|
+
on {{:title|core}}.
|
251
|
+
</p>
|
252
|
+
|
253
|
+
<p><em>-- the machines running {{:title|core}}</em></p>
|
254
|
+
|
255
|
+
|
256
|
+
- :name: "*signin"
|
257
|
+
:codename: signin
|
258
|
+
:conflict: :defer
|
259
|
+
:fields:
|
260
|
+
:self:
|
261
|
+
:fields:
|
262
|
+
:update: Anyone
|
263
|
+
- :name: "*roles"
|
264
|
+
:codename: roles
|
265
|
+
:fields:
|
266
|
+
:right:
|
267
|
+
:fields:
|
268
|
+
:input_type: checkbox
|
269
|
+
:content_options:
|
270
|
+
:type: :search_type
|
271
|
+
:content: '{"type":"role", "not":{"codename":["in","anyone","anyone_signed_in"]}}'
|
272
|
+
|
273
|
+
|
274
|
+
- :name: "*enabled roles"
|
275
|
+
:codename: enabled_roles
|
276
|
+
- :name: "*account links"
|
277
|
+
:codename: account_links
|
278
|
+
|
279
|
+
- :name: Cards with accounts
|
280
|
+
:type: :search_type
|
281
|
+
:codename: cards_with_account
|
282
|
+
:content: '{"right_plus": ":account"}'
|
283
|
+
|
284
|
+
- :name: "*thanks"
|
285
|
+
:type: :setting
|
286
|
+
:codename: thanks
|
287
|
+
- :name:
|
288
|
+
- :signup
|
289
|
+
- :type
|
290
|
+
- :thanks
|
291
|
+
:type: :phrase
|
292
|
+
:content: :signup_success
|
293
|
+
|
294
|
+
- :name: Signup Success
|
295
|
+
:codename: signup_success
|
296
|
+
:content: |-
|
297
|
+
<div>
|
298
|
+
Thank you for signing up with {{:title|core}}.
|
299
|
+
You should receive a response in your email.
|
300
|
+
</div>
|
@@ -0,0 +1,47 @@
|
|
1
|
+
# -*- encoding : utf-8 -*-
|
2
|
+
|
3
|
+
class MoveRoles < Cardio::Migration
|
4
|
+
def up
|
5
|
+
remove_member_structure_rule
|
6
|
+
change_existing_member_cards_to_lists
|
7
|
+
populate_member_lists_and_delete_role_lists
|
8
|
+
end
|
9
|
+
|
10
|
+
def remove_member_structure_rule
|
11
|
+
%i[members right structure].card&.delete!
|
12
|
+
end
|
13
|
+
|
14
|
+
def change_existing_member_cards_to_lists
|
15
|
+
Card.search(left: { type_id: Card::RoleID },
|
16
|
+
right_id: Card::MembersID) do |role_members|
|
17
|
+
role_members.update! type_id: Card::ListID
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def populate_member_lists_and_delete_role_lists
|
22
|
+
Card.search(left: { type_id: Card::UserID },
|
23
|
+
right_id: Card::RolesID) do |user_roles|
|
24
|
+
role_names = role_names_from_user_roles_card user_roles.id
|
25
|
+
move_role_names user_roles.left.name, role_names if role_names.present?
|
26
|
+
user_roles.delete
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def move_role_names user, role_names
|
31
|
+
role_names.each do |role_name|
|
32
|
+
next unless role_name.card&.type_code == :role
|
33
|
+
|
34
|
+
puts "Move #{user} to role #{role_name}"
|
35
|
+
Card.fetch(role_name, :members, new: {}).add_item! user
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
def role_names_from_user_roles_card id
|
40
|
+
query = "SELECT db_content FROM cards WHERE cards.id = #{id}"
|
41
|
+
content = ActiveRecord::Base.connection
|
42
|
+
.exec_query(query)
|
43
|
+
.rows&.first&.first
|
44
|
+
return unless content.present?
|
45
|
+
content.split "\n"
|
46
|
+
end
|
47
|
+
end
|
@@ -6,9 +6,7 @@ end
|
|
6
6
|
|
7
7
|
# allow account owner to update account field content
|
8
8
|
def ok_to_update
|
9
|
-
|
10
|
-
|
11
|
-
super
|
9
|
+
(own_account? && !name_changed? && !type_id_changed?) || super
|
12
10
|
end
|
13
11
|
|
14
12
|
# force inherit permission on create
|
data/set/abstract/accountable.rb
CHANGED
@@ -37,7 +37,7 @@ format :html do
|
|
37
37
|
["Email and Password", :account,
|
38
38
|
{ path: { slot: { hide: %i[help_link bridge_link] } } }],
|
39
39
|
["Roles", :roles,
|
40
|
-
{ path: { view: :
|
40
|
+
{ path: { view: :content } }],
|
41
41
|
["Notifications", :follow],
|
42
42
|
["API", :account,
|
43
43
|
{ path: { view: :api_key,
|
data/set/all/account.rb
CHANGED
@@ -15,7 +15,7 @@ end
|
|
15
15
|
def among? ok_ids
|
16
16
|
ok_ids.any? do |ok_id|
|
17
17
|
ok_id == AnyoneID ||
|
18
|
-
(ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
|
18
|
+
# (ok_id == AnyoneWithRoleID && all_enabled_roles.size > 1) ||
|
19
19
|
parties.member?(ok_id)
|
20
20
|
end
|
21
21
|
end
|
@@ -86,14 +86,11 @@ def enabled_roles_card
|
|
86
86
|
end
|
87
87
|
|
88
88
|
def fetch_roles
|
89
|
-
[AnyoneSignedInID] +
|
89
|
+
[AnyoneSignedInID] + role_ids_from_role_member_cards
|
90
90
|
end
|
91
91
|
|
92
|
-
def
|
93
|
-
|
94
|
-
role_trait = fetch :roles
|
95
|
-
role_trait ? role_trait.item_ids : []
|
96
|
-
end
|
92
|
+
def role_ids_from_role_member_cards
|
93
|
+
Self::Role.role_ids id
|
97
94
|
end
|
98
95
|
|
99
96
|
event :generate_token do
|
data/set/right/account/events.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
#### ON CREATE
|
2
2
|
|
3
3
|
event :set_default_salt, :prepare_to_validate, on: :create do
|
4
|
-
|
4
|
+
field(:salt).generate
|
5
5
|
end
|
6
6
|
|
7
7
|
event :set_default_status, :prepare_to_validate, on: :create do
|
8
|
-
|
8
|
+
field :status, content: (accounted&.try(:default_account_status) || "active")
|
9
9
|
end
|
10
10
|
|
11
11
|
# ON UPDATE
|
@@ -47,7 +47,7 @@ end
|
|
47
47
|
# NOTE: this only works in the context of an action.
|
48
48
|
# if run independently, it will not activate an account
|
49
49
|
event :activate_account do
|
50
|
-
|
50
|
+
field :status, content: "active"
|
51
51
|
trigger_event! :send_welcome_email
|
52
52
|
end
|
53
53
|
|
data/set/right/account/views.rb
CHANGED
data/set/right/account.rb
CHANGED
@@ -21,9 +21,7 @@ end
|
|
21
21
|
|
22
22
|
# allow account owner to update account field content
|
23
23
|
def ok_to_update
|
24
|
-
|
25
|
-
|
26
|
-
super
|
24
|
+
(own_account? && !name_changed? && !type_id_changed?) || super
|
27
25
|
end
|
28
26
|
|
29
27
|
def changes_visible? act
|
data/set/right/email.rb
CHANGED
@@ -2,6 +2,8 @@
|
|
2
2
|
|
3
3
|
include_set Abstract::AccountField
|
4
4
|
|
5
|
+
assign_type :phrase
|
6
|
+
|
5
7
|
event :validate_email, :validate, on: :save do
|
6
8
|
return unless content?
|
7
9
|
|
@@ -31,7 +33,7 @@ event :downcase_email, :prepare_to_validate, on: :save do
|
|
31
33
|
end
|
32
34
|
|
33
35
|
def email_required?
|
34
|
-
!left
|
36
|
+
!left&.left&.codename == :wagn_bot
|
35
37
|
end
|
36
38
|
|
37
39
|
def ok_to_read
|
data/set/right/password.rb
CHANGED
data/set/right/roles.rb
CHANGED
@@ -1,27 +1,9 @@
|
|
1
|
-
|
2
|
-
return unless (fr = forbidden_roles).present?
|
1
|
+
assign_type :search_type
|
3
2
|
|
4
|
-
|
5
|
-
|
6
|
-
"#{fr.map(&:name).to_sentence}" # LOCALIZE
|
3
|
+
def virtual?
|
4
|
+
new?
|
7
5
|
end
|
8
6
|
|
9
|
-
def
|
10
|
-
|
11
|
-
with_old_role_permissions do |new_roles|
|
12
|
-
new_roles.reject do |card|
|
13
|
-
Card.fetch(card, "*members").ok? :update
|
14
|
-
end
|
15
|
-
end
|
16
|
-
end
|
17
|
-
|
18
|
-
def with_old_role_permissions
|
19
|
-
new_roles = item_cards
|
20
|
-
new_content = content
|
21
|
-
left.clear_roles
|
22
|
-
Auth.update_always_cache nil
|
23
|
-
self.content = db_content_before_act
|
24
|
-
yield new_roles
|
25
|
-
ensure
|
26
|
-
self.content = new_content
|
7
|
+
def cql_content
|
8
|
+
{ member: "_left" }
|
27
9
|
end
|
data/set/right/salt.rb
CHANGED
data/set/right/status.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
include_set Abstract::AccountField
|
2
|
-
include_set Abstract::
|
2
|
+
include_set Abstract::List
|
3
|
+
|
4
|
+
assign_type :phrase
|
3
5
|
|
4
6
|
format :html do
|
5
7
|
def input_type
|
@@ -8,7 +10,7 @@ format :html do
|
|
8
10
|
end
|
9
11
|
|
10
12
|
def option_names
|
11
|
-
%w[unapproved unverified active blocked system
|
13
|
+
%w[unapproved unverified active blocked] # system
|
12
14
|
end
|
13
15
|
|
14
16
|
def ok_to_update
|
data/set/self/role.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
class << self
|
2
|
+
CACHE_KEY = "ROLEHASH".freeze
|
3
|
+
|
4
|
+
def load_rolehash
|
5
|
+
::Card.cache.fetch(CACHE_KEY) do
|
6
|
+
generate_rolehash
|
7
|
+
end
|
8
|
+
end
|
9
|
+
|
10
|
+
def generate_rolehash
|
11
|
+
Auth.as_bot do
|
12
|
+
Card.search(left: { type_id: Card::RoleID }, right_id: Card::MembersID)
|
13
|
+
.each_with_object({}) do |member_card, hash|
|
14
|
+
hash[member_card.left_id] = ::Set.new member_card.item_ids
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def update_rolehash role_id, member_ids
|
20
|
+
role_hash[role_id] = member_ids
|
21
|
+
::Card.cache.write CACHE_KEY, role_hash
|
22
|
+
end
|
23
|
+
|
24
|
+
def clear_rolehash
|
25
|
+
@role_hash = nil
|
26
|
+
end
|
27
|
+
|
28
|
+
def role_hash
|
29
|
+
@role_hash ||= load_rolehash
|
30
|
+
end
|
31
|
+
|
32
|
+
def role_ids user_id
|
33
|
+
role_hash.each_with_object([]) do |(role_id, member_ids), all_role_ids|
|
34
|
+
next unless member_ids.include? user_id
|
35
|
+
all_role_ids << role_id
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
data/set/self/signin.rb
CHANGED
@@ -8,7 +8,7 @@
|
|
8
8
|
|
9
9
|
# authentication event
|
10
10
|
event :signin, :validate, on: :update do
|
11
|
-
authenticate_or_abort
|
11
|
+
authenticate_or_abort field_content(:email), field_content(:password)
|
12
12
|
end
|
13
13
|
|
14
14
|
# abort after successful signin (do not save card)
|
@@ -22,7 +22,7 @@ event :signout, :validate, on: :delete do
|
|
22
22
|
abort :success
|
23
23
|
end
|
24
24
|
|
25
|
-
# triggered by clicking "Reset
|
25
|
+
# triggered by clicking "Reset Password", this sends out the verification password
|
26
26
|
# and aborts (does not sign in)
|
27
27
|
event :send_reset_password_token, before: :signin, on: :update, trigger: :required do
|
28
28
|
aborting do
|
@@ -30,8 +30,8 @@ event :send_reset_password_token, before: :signin, on: :update, trigger: :requir
|
|
30
30
|
end
|
31
31
|
end
|
32
32
|
|
33
|
-
def
|
34
|
-
@
|
33
|
+
def email_from_field
|
34
|
+
@email_from_field ||= field_content(:email)
|
35
35
|
end
|
36
36
|
|
37
37
|
def ok_to_read
|
@@ -76,7 +76,7 @@ def account_for email
|
|
76
76
|
end
|
77
77
|
|
78
78
|
def send_reset_password_email_or_fail
|
79
|
-
if (account = account_for
|
79
|
+
if (account = account_for email_from_field)&.active?
|
80
80
|
send_reset_password_email account
|
81
81
|
else
|
82
82
|
reset_password_fail account
|
@@ -84,7 +84,7 @@ def send_reset_password_email_or_fail
|
|
84
84
|
end
|
85
85
|
|
86
86
|
def blank_email?
|
87
|
-
return false if
|
87
|
+
return false if email_from_field.present?
|
88
88
|
|
89
89
|
error_on :email, :error_blank
|
90
90
|
end
|
@@ -112,14 +112,14 @@ def signin_error_key account
|
|
112
112
|
end
|
113
113
|
|
114
114
|
format :html do
|
115
|
-
|
115
|
+
before :core do
|
116
116
|
voo.edit_structure = [signin_field(:email), signin_field(:password)]
|
117
|
+
end
|
118
|
+
|
119
|
+
view :core, cache: :never do
|
117
120
|
with_nest_mode :edit do
|
118
121
|
card_form :update, recaptcha: :off, success: signin_success do
|
119
|
-
|
120
|
-
_render_content_formgroups,
|
121
|
-
_render_signin_buttons
|
122
|
-
]
|
122
|
+
haml :core
|
123
123
|
end
|
124
124
|
end
|
125
125
|
end
|
@@ -150,12 +150,6 @@ format :html do
|
|
150
150
|
frame { t :account_check_email }
|
151
151
|
end
|
152
152
|
|
153
|
-
view :signin_buttons do
|
154
|
-
button_formgroup do
|
155
|
-
[signin_button, signup_link, reset_password_link]
|
156
|
-
end
|
157
|
-
end
|
158
|
-
|
159
153
|
# FORGOT PASSWORD
|
160
154
|
view :edit do
|
161
155
|
reset_password_voo
|
@@ -169,7 +163,7 @@ format :html do
|
|
169
163
|
end
|
170
164
|
|
171
165
|
view :edit_buttons do
|
172
|
-
button_tag t(:
|
166
|
+
button_tag t(:account_reset_password),
|
173
167
|
situation: "primary", class: "_close-modal-on-success"
|
174
168
|
end
|
175
169
|
|
@@ -182,14 +176,13 @@ format :html do
|
|
182
176
|
end
|
183
177
|
|
184
178
|
def signup_link
|
185
|
-
|
179
|
+
link_to_card :signup, t(:account_or_sign_up),
|
180
|
+
path: { action: :new, mark: :signup }
|
186
181
|
end
|
187
182
|
|
188
183
|
def reset_password_link
|
189
|
-
|
190
|
-
|
191
|
-
# FIXME: inline styling
|
192
|
-
raw("<div style='float:right'>#{link}</div>")
|
184
|
+
link_to_view :edit, t(:account_reset_password),
|
185
|
+
path: { slot: { hide: :bridge_link } }
|
193
186
|
end
|
194
187
|
|
195
188
|
def edit_view_hidden
|
data/set/type/role.rb
CHANGED
@@ -1,3 +1,5 @@
|
|
1
|
+
card_accessor :members
|
2
|
+
|
1
3
|
def disabled?
|
2
4
|
Auth.current&.fetch(:disabled_roles)&.item_ids&.include? id
|
3
5
|
end
|
@@ -9,7 +11,7 @@ format :html do
|
|
9
11
|
|
10
12
|
def role_checkbox
|
11
13
|
name = card.disabled? ? "add_item" : "drop_item"
|
12
|
-
subformat(Auth.current.field(:disabled_roles
|
14
|
+
subformat(Auth.current.field(:disabled_roles)).card_form :update do
|
13
15
|
[check_box_tag(name, card.id, !card.disabled?, class: "_edit-item"),
|
14
16
|
render_link]
|
15
17
|
end
|
data/set/type/signup/views.rb
CHANGED
@@ -3,16 +3,16 @@ format :html do
|
|
3
3
|
Auth.signed_in? && card.can_approve?
|
4
4
|
end
|
5
5
|
|
6
|
-
view :new do
|
6
|
+
view :new, cache: :never do
|
7
7
|
voo.title = invitation? ? t(:account_invite) : t(:account_sign_up)
|
8
8
|
super()
|
9
9
|
end
|
10
10
|
|
11
11
|
view :content_formgroups do
|
12
|
-
[account_formgroups, (
|
12
|
+
[account_formgroups, (multi_card_editor? ? multi_card_edit(true) : "")].join
|
13
13
|
end
|
14
14
|
|
15
|
-
view :new_buttons do
|
15
|
+
view :new_buttons, cache: :never do
|
16
16
|
button_formgroup do
|
17
17
|
[standard_create_button, invite_button].compact
|
18
18
|
end
|
@@ -24,11 +24,12 @@ format :html do
|
|
24
24
|
button_tag "Send Invitation", situation: "primary"
|
25
25
|
end
|
26
26
|
|
27
|
-
view :core, template: :haml do
|
27
|
+
view :core, template: :haml, cache: :never do
|
28
28
|
@lines = [signup_line] + account_lines
|
29
29
|
@body = process_content _render_raw
|
30
30
|
end
|
31
31
|
|
32
|
+
# TODO: localize
|
32
33
|
def signup_line
|
33
34
|
["<strong>#{safe_name}</strong>",
|
34
35
|
("was" if invited?),
|
data/set/type/signup.rb
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
include_set Abstract::Accountable
|
2
2
|
|
3
|
+
basket[:non_createable_types] << :signup
|
4
|
+
|
3
5
|
require_field :account
|
4
6
|
|
5
7
|
def default_account_status
|
@@ -26,7 +28,7 @@ event :approve_without_verification, :validate, on: :update, trigger: :required
|
|
26
28
|
# TODO: if validated here, add trigger and activate in storage phase
|
27
29
|
approvable do
|
28
30
|
activate_accounted
|
29
|
-
|
31
|
+
field(:account).activate_account
|
30
32
|
end
|
31
33
|
end
|
32
34
|
|
@@ -36,8 +38,8 @@ event :act_as_current_for_integrate_stage, :integrate, on: :create do
|
|
36
38
|
end
|
37
39
|
|
38
40
|
def request_verification
|
39
|
-
acct =
|
40
|
-
acct.
|
41
|
+
acct = field :account
|
42
|
+
acct.field :status, content: "unverified"
|
41
43
|
acct.trigger_event! :send_verification_email
|
42
44
|
end
|
43
45
|
|
data/set/type/user.rb
CHANGED
@@ -3,7 +3,9 @@ include_set Abstract::Accountable
|
|
3
3
|
attr_accessor :email
|
4
4
|
|
5
5
|
format :html do
|
6
|
-
|
6
|
+
delegate :needs_setup?, to: Card::Auth
|
7
|
+
|
8
|
+
view :setup, unknown: true, perms: :needs_setup? do
|
7
9
|
with_nest_mode :edit do
|
8
10
|
voo.title = "Your deck is ready to go!" # LOCALIZE
|
9
11
|
voo.show! :help
|
@@ -41,6 +43,7 @@ format :html do
|
|
41
43
|
end
|
42
44
|
end
|
43
45
|
|
46
|
+
# FIXME. use trigger
|
44
47
|
def setup?
|
45
48
|
Card::Env.params[:setup]
|
46
49
|
end
|
@@ -54,8 +57,10 @@ event :setup_as_bot, before: :check_permissions, on: :create, when: :setup? do
|
|
54
57
|
end
|
55
58
|
|
56
59
|
event :setup_first_user, :prepare_to_store, on: :create, when: :setup? do
|
57
|
-
subcard
|
58
|
-
|
60
|
+
subcard %i[signup_alert_email to].cardname, content: name
|
61
|
+
roles_for_first_user.each do |role|
|
62
|
+
subcard [role, :members], content: name
|
63
|
+
end
|
59
64
|
end
|
60
65
|
|
61
66
|
def roles_for_first_user
|
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.
|
4
|
+
version: 0.15.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:
|
13
|
+
date: 2023-03-29 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: card
|
@@ -18,56 +18,84 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 1.
|
21
|
+
version: 1.105.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.
|
28
|
+
version: 1.105.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.
|
35
|
+
version: 0.15.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.
|
42
|
+
version: 0.15.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.
|
49
|
+
version: 0.15.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.
|
56
|
+
version: 0.15.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.
|
63
|
+
version: 0.15.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.
|
70
|
+
version: 0.15.1
|
71
|
+
- !ruby/object:Gem::Dependency
|
72
|
+
name: card-mod-integrate
|
73
|
+
requirement: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - '='
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: 0.15.1
|
78
|
+
type: :runtime
|
79
|
+
prerelease: false
|
80
|
+
version_requirements: !ruby/object:Gem::Requirement
|
81
|
+
requirements:
|
82
|
+
- - '='
|
83
|
+
- !ruby/object:Gem::Version
|
84
|
+
version: 0.15.1
|
85
|
+
- !ruby/object:Gem::Dependency
|
86
|
+
name: card-mod-edit
|
87
|
+
requirement: !ruby/object:Gem::Requirement
|
88
|
+
requirements:
|
89
|
+
- - '='
|
90
|
+
- !ruby/object:Gem::Version
|
91
|
+
version: 0.15.1
|
92
|
+
type: :runtime
|
93
|
+
prerelease: false
|
94
|
+
version_requirements: !ruby/object:Gem::Requirement
|
95
|
+
requirements:
|
96
|
+
- - '='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: 0.15.1
|
71
99
|
description: ''
|
72
100
|
email:
|
73
101
|
- info@decko.org
|
@@ -76,8 +104,11 @@ extensions: []
|
|
76
104
|
extra_rdoc_files: []
|
77
105
|
files:
|
78
106
|
- README.md
|
79
|
-
-
|
80
|
-
- locales/
|
107
|
+
- assets/style/account.scss
|
108
|
+
- config/locales/de.yml
|
109
|
+
- config/locales/en.yml
|
110
|
+
- data/real.yml
|
111
|
+
- db/migrate_core_cards/20220815112551_move_roles.rb
|
81
112
|
- set/abstract/account_field.rb
|
82
113
|
- set/abstract/accountable.rb
|
83
114
|
- set/all/account.rb
|
@@ -89,13 +120,16 @@ files:
|
|
89
120
|
- set/right/roles.rb
|
90
121
|
- set/right/salt.rb
|
91
122
|
- set/right/status.rb
|
123
|
+
- set/self/role.rb
|
92
124
|
- set/self/signin.rb
|
125
|
+
- set/self/signin/core.haml
|
93
126
|
- set/type/role.rb
|
94
127
|
- set/type/signup.rb
|
95
128
|
- set/type/signup/core.haml
|
96
129
|
- set/type/signup/views.rb
|
97
130
|
- set/type/user.rb
|
98
131
|
- set/type/user/setup_help.haml
|
132
|
+
- set/type_plus_right/role/members.rb
|
99
133
|
- set/type_plus_right/user/email.rb
|
100
134
|
homepage: https://decko.org
|
101
135
|
licenses:
|
@@ -107,6 +141,7 @@ metadata:
|
|
107
141
|
wiki_uri: https://decko.org
|
108
142
|
documentation_url: http://docs.decko.org/
|
109
143
|
card-mod: account
|
144
|
+
card-mod-group: gem-defaults
|
110
145
|
post_install_message:
|
111
146
|
rdoc_options: []
|
112
147
|
require_paths:
|
@@ -122,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
122
157
|
- !ruby/object:Gem::Version
|
123
158
|
version: '0'
|
124
159
|
requirements: []
|
125
|
-
rubygems_version: 3.
|
160
|
+
rubygems_version: 3.3.11
|
126
161
|
signing_key:
|
127
162
|
specification_version: 4
|
128
163
|
summary: Email-based account handling for decko cards
|