card 1.19.6 → 1.20.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/VERSION +1 -1
- data/card.gemspec +8 -7
- data/config/initializers/01_core_extensions/array.rb +4 -0
- data/config/initializers/01_core_extensions/persistent_identifiers.rb +12 -0
- data/config/initializers/02_patches/better_errors.rb +56 -0
- data/config/initializers/core_extensions.rb +13 -18
- data/config/initializers/patches.rb +8 -0
- data/config/locales/de.yml +0 -2
- data/db/migrate_core_cards/20150202143810_import_bootstrap_layout.rb +22 -12
- data/db/migrate_core_cards/20161102202156_tweak_recaptcha_setting_cards.rb +17 -0
- data/db/migrate_core_cards/20161103154836_update_keys.rb +46 -0
- data/lib/card.rb +1 -8
- data/lib/card/act_manager.rb +4 -0
- data/lib/card/auth/permissions.rb +5 -3
- data/lib/card/cache.rb +1 -20
- data/lib/card/cache/persistent.rb +6 -0
- data/lib/card/content/chunk.rb +4 -3
- data/lib/card/content/diff.rb +2 -2
- data/lib/card/content/diff/result.rb +11 -0
- data/lib/card/env/success.rb +4 -0
- data/lib/card/error.rb +2 -0
- data/lib/card/format.rb +14 -17
- data/lib/card/format/content.rb +16 -8
- data/lib/card/format/error.rb +3 -5
- data/lib/card/format/names.rb +22 -16
- data/lib/card/format/nest.rb +67 -61
- data/lib/card/format/nest/fetch.rb +40 -33
- data/lib/card/format/nest/main.rb +39 -19
- data/lib/card/format/nest/subformat.rb +3 -16
- data/lib/card/format/nest/view.rb +23 -32
- data/lib/card/format/permission.rb +49 -34
- data/lib/card/format/registration.rb +12 -6
- data/lib/card/format/render.rb +62 -73
- data/lib/card/migration.rb +14 -10
- data/lib/card/migration/import.rb +20 -19
- data/lib/card/migration/import/import_data.rb +50 -59
- data/lib/card/migration/import/import_data/card_attributes.rb +56 -0
- data/lib/card/migration/import/import_data/card_content.rb +33 -0
- data/lib/card/migration/import/merger.rb +47 -0
- data/lib/card/mod/loader.rb +4 -4
- data/lib/card/model/save_helper.rb +49 -10
- data/lib/card/name.rb +16 -52
- data/lib/card/name/fields_and_traits.rb +67 -0
- data/lib/card/name/variants.rb +17 -0
- data/lib/card/query.rb +6 -2
- data/lib/card/query/attributes.rb +1 -1
- data/lib/card/query/interpretation.rb +3 -3
- data/lib/card/set/event.rb +2 -1
- data/lib/card/set/format.rb +18 -7
- data/lib/card/set_pattern.rb +17 -13
- data/lib/card/tasks/card.rake +1 -1
- data/lib/card/view.rb +55 -0
- data/lib/card/view/cache.rb +90 -0
- data/lib/card/view/fetch.rb +109 -0
- data/lib/card/view/options.rb +164 -0
- data/lib/card/view/stub.rb +30 -0
- data/lib/card/view/visibility.rb +95 -0
- data/lib/cardio.rb +3 -2
- data/lib/cardio/schema.rb +21 -8
- data/lib/generators/card.rb +16 -2
- data/lib/generators/card/format/format_generator.rb +10 -9
- data/lib/generators/card/migration/migration_generator.rb +10 -5
- data/lib/generators/card/set/USAGE +1 -1
- data/lib/generators/card/set/set_generator.rb +11 -9
- data/mod/account/set/right/account.rb +38 -40
- data/mod/account/set/right/token.rb +2 -1
- data/mod/account/set/self/account_links.rb +34 -54
- data/mod/account/set/self/signin.rb +107 -93
- data/mod/account/set/type/signup.rb +33 -32
- data/mod/account/set/type/user.rb +28 -21
- data/mod/account/spec/set/all/account_spec.rb +9 -9
- data/mod/account/spec/set/right/account_spec.rb +23 -14
- data/mod/account/spec/set/right/email_spec.rb +6 -6
- data/mod/account/spec/set/right/password_spec.rb +4 -4
- data/mod/account/spec/set/right/token_spec.rb +3 -3
- data/mod/account/spec/set/self/account_links_spec.rb +3 -3
- data/mod/account/spec/set/self/signin_spec.rb +2 -2
- data/mod/account/spec/set/type/signup_spec.rb +7 -8
- data/mod/ace_editor/set/abstract/ace_editor.rb +1 -4
- data/mod/admin/set/self/admin.rb +2 -2
- data/mod/admin/set/self/admin_info.rb +1 -1
- data/mod/admin/set/self/recaptcha_private_key.rb +3 -0
- data/mod/admin/set/self/recaptcha_proxy.rb +3 -0
- data/mod/admin/set/self/recaptcha_public_key.rb +3 -0
- data/mod/admin/set/self/trash.rb +4 -4
- data/mod/admin/spec/set/self/admin_spec.rb +4 -4
- data/mod/admin/spec/set/self/version_spec.rb +1 -1
- data/mod/basic_formats/set/all/all_css.rb +3 -3
- data/mod/basic_formats/set/all/all_csv.rb +6 -6
- data/mod/basic_formats/set/all/all_js.rb +4 -0
- data/mod/basic_formats/set/all/base.rb +40 -62
- data/mod/basic_formats/set/all/json.rb +34 -39
- data/mod/basic_formats/set/all/rss.rb +6 -6
- data/mod/basic_formats/set/all/text.rb +3 -2
- data/mod/basic_formats/set/self/01_head/javascript.rb +2 -2
- data/mod/basic_formats/set/self/head.rb +6 -10
- data/mod/basic_formats/spec/set/all/all_css_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/all_csv_spec.rb +1 -1
- data/mod/basic_formats/spec/set/all/base_spec.rb +8 -5
- data/mod/basic_formats/spec/set/all/json_spec.rb +2 -2
- data/mod/basic_formats/spec/set/all/rss_spec.rb +4 -4
- data/mod/basic_types/set/type/plain_text.rb +3 -5
- data/mod/basic_types/spec/set/type/plain_text_spec.rb +2 -2
- data/mod/bootstrap/lib/bootstrap.rb +16 -0
- data/mod/bootstrap/lib/bootstrap/basic_tags.rb +26 -0
- data/mod/bootstrap/lib/bootstrap/component.rb +133 -0
- data/mod/bootstrap/lib/bootstrap/component/form.rb +31 -0
- data/mod/bootstrap/lib/bootstrap/component/horizontal_form.rb +38 -0
- data/mod/bootstrap/lib/bootstrap/component/layout.rb +83 -0
- data/mod/bootstrap/lib/bootstrap/component/panel.rb +9 -0
- data/mod/bootstrap/lib/bootstrap/component_loader.rb +30 -0
- data/mod/bootstrap/lib/bootstrap/delegate.rb +16 -0
- data/mod/bootstrap/lib/bootstrapper.rb +16 -0
- data/mod/bootstrap/lib/stylesheets/bootstrap/_tables.scss +55 -52
- data/mod/bootstrap/lib/stylesheets/bootstrap/mixins/_table-row.scss +12 -12
- data/mod/bootstrap/lib/stylesheets/bootstrap_cards.scss +12 -0
- data/mod/bootstrap/set/all/bootstrap/accordion.rb +63 -0
- data/mod/bootstrap/set/all/bootstrap/helper.rb +7 -140
- data/mod/bootstrap/set/all/bootstrap/navbar.rb +74 -0
- data/mod/bootstrap/set/all/bootstrap/table.rb +76 -46
- data/mod/bootstrap/set/all/bootstrap/tabs.rb +58 -23
- data/mod/bootstrap/set/all/bootstrap/wrapper.rb +14 -8
- data/mod/bootstrap/set/all/rich_bootstrap.rb +5 -3
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_builder_spec.rb +31 -0
- data/mod/bootstrap/spec/set/all/bootstrap/bootstrap_spec.rb +20 -0
- data/mod/bootstrap/spec/set/all/bootstrap/form_spec.rb +59 -1
- data/mod/bootstrap/spec/set/all/bootstrap/layout_spec.rb +104 -15
- data/mod/carrierwave/set/abstract/attachment.rb +4 -3
- data/mod/carrierwave/set/abstract/attachment/paths.rb +1 -1
- data/mod/carrierwave/set/abstract/attachment/storage_type.rb +5 -11
- data/mod/carrierwave/set/type/file.rb +39 -32
- data/mod/carrierwave/set/type/image.rb +59 -34
- data/mod/carrierwave/spec/set/type/image_spec.rb +3 -3
- data/mod/core/chunk/link.rb +5 -0
- data/mod/core/chunk/{include.rb → nest.rb} +8 -29
- data/mod/core/chunk/reference.rb +5 -6
- data/mod/core/chunk/view_stub.rb +42 -0
- data/mod/core/format/html_format.rb +23 -26
- data/mod/core/set/abstract/code_file.rb +1 -1
- data/mod/core/set/all/actify.rb +1 -1
- data/mod/core/set/all/active_card.rb +0 -1
- data/mod/core/set/all/{tracked_attributes.rb → assign_attributes.rb} +55 -24
- data/mod/core/set/all/collection.rb +136 -122
- data/mod/core/set/all/content.rb +8 -0
- data/mod/core/set/all/event.rb +5 -2
- data/mod/core/set/all/export.rb +7 -7
- data/mod/core/set/all/fetch.rb +90 -26
- data/mod/core/set/all/initialize.rb +17 -6
- data/mod/core/set/all/name.rb +2 -3
- data/mod/core/set/all/permissions.rb +19 -11
- data/mod/core/set/all/states.rb +12 -2
- data/mod/core/set/all/trash.rb +1 -1
- data/mod/core/set/all/type.rb +2 -0
- data/mod/core/set/all/utils.rb +4 -3
- data/mod/core/spec/chunk/literal_spec.rb +2 -2
- data/mod/core/spec/chunk/uri_spec.rb +17 -17
- data/mod/core/spec/format/html_format_spec.rb +11 -13
- data/mod/core/spec/set/all/attribute_tracking_spec.rb +2 -2
- data/mod/core/spec/set/all/collection_spec.rb +21 -24
- data/mod/core/spec/set/all/content_spec.rb +1 -1
- data/mod/core/spec/set/all/export_spec.rb +3 -3
- data/mod/core/spec/set/all/fetch_spec.rb +5 -5
- data/mod/core/spec/set/all/initialize_spec.rb +4 -4
- data/mod/core/spec/set/all/name_spec.rb +6 -6
- data/mod/core/spec/set/all/permissions_spec.rb +10 -10
- data/mod/core/spec/set/all/references_spec.rb +1 -1
- data/mod/core/spec/set/all/rules2_spec.rb +24 -24
- data/mod/core/spec/set/all/rules_spec.rb +1 -1
- data/mod/core/spec/set/all/templating_spec.rb +8 -8
- data/mod/core/spec/set/all/tracked_attributes_spec.rb +6 -6
- data/mod/core/spec/set/all/type_spec.rb +5 -5
- data/mod/developer/spec/set/all/event_viz_spec.rb +1 -1
- data/mod/developer/spec/set/right/debug_spec.rb +1 -1
- data/mod/email/set/all/email_html.rb +2 -2
- data/mod/email/set/all/notify.rb +8 -3
- data/mod/email/set/right/bcc.rb +3 -3
- data/mod/email/set/right/follow.rb +5 -5
- data/mod/email/set/right/following.rb +1 -1
- data/mod/email/set/self/follow_defaults.rb +27 -16
- data/mod/email/set/type/email_template.rb +1 -1
- data/mod/email/set/type_plus_right/user/follow.rb +10 -9
- data/mod/history/lib/card/act.rb +4 -0
- data/mod/history/lib/card/act/act_renderer.rb +194 -0
- data/mod/history/lib/card/act/act_renderer/absolute_act_renderer.rb +25 -0
- data/mod/history/lib/card/act/act_renderer/relative_act_renderer.rb +41 -0
- data/mod/history/lib/card/action.rb +1 -0
- data/mod/history/lib/card/action/action_renderer.rb +92 -0
- data/mod/history/lib/card/action/differ.rb +6 -1
- data/mod/history/set/all/act_view.rb +64 -0
- data/mod/history/set/all/action_view.rb +65 -0
- data/mod/history/set/all/content_history.rb +44 -37
- data/mod/history/set/all/history.rb +49 -263
- data/mod/machines/lib/stylesheets/style_cards.scss +30 -115
- data/mod/machines/set/abstract/script.rb +42 -7
- data/mod/machines/set/right/machine_input.rb +4 -0
- data/mod/machines/set/type/coffee_script.rb +8 -22
- data/mod/machines/set/type/css.rb +2 -2
- data/mod/machines/set/type/java_script.rb +4 -24
- data/mod/machines/set/type/scss.rb +1 -1
- data/mod/machines/spec/set/type/css_spec.rb +1 -1
- data/mod/machines/spec/set/type/scss_spec.rb +3 -3
- data/mod/machines/spec/set/type/skin_spec.rb +7 -7
- data/mod/pointer/set/abstract/01_pointer.rb +44 -46
- data/mod/pointer/set/abstract/01_pointer/edit.rb +13 -13
- data/mod/pointer/set/right/options.rb +4 -0
- data/mod/pointer/spec/set/type/pointer_spec.rb +7 -7
- data/mod/prosemirror_editor/set/abstract/prosemirror_editor.rb +3 -3
- data/mod/settings/set/abstract/permission.rb +25 -18
- data/mod/settings/set/right/add_help.rb +3 -3
- data/mod/settings/set/right/structure.rb +10 -16
- data/mod/settings/spec/set/right/comment_spec.rb +3 -3
- data/mod/settings/spec/set/right/create_spec.rb +1 -1
- data/mod/settings/spec/set/right/style_spec.rb +1 -1
- data/mod/settings/spec/set/type/setting_spec.rb +1 -1
- data/mod/solid_cache/set/abstract/solid_cache.rb +4 -4
- data/mod/solid_cache/set/right/solid_cache.rb +9 -10
- data/mod/standard/set/abstract/01_search_params.rb +41 -0
- data/mod/standard/set/abstract/search.rb +132 -0
- data/mod/standard/set/abstract/search/paging.rb +81 -0
- data/mod/standard/set/abstract/search/paging/paging_links.rb +90 -0
- data/mod/standard/set/abstract/wql_search.rb +67 -0
- data/mod/standard/set/all/error.rb +89 -82
- data/mod/standard/set/all/links.rb +1 -1
- data/mod/standard/set/all/rich_html/content.rb +125 -141
- data/mod/standard/set/all/rich_html/editing.rb +115 -178
- data/mod/standard/set/all/rich_html/form.rb +111 -131
- data/mod/standard/set/all/rich_html/header.rb +57 -39
- data/mod/standard/set/all/rich_html/menu.rb +94 -94
- data/mod/standard/set/all/rich_html/modal.rb +5 -10
- data/mod/standard/set/all/rich_html/new.rb +103 -0
- data/mod/standard/set/all/rich_html/toolbar.rb +54 -74
- data/mod/standard/set/all/rich_html/wrapper.rb +111 -138
- data/mod/standard/set/rstar/rules.rb +27 -38
- data/mod/standard/set/rstar/rules_editor.rb +298 -277
- data/mod/standard/set/self/navbox.rb +20 -15
- data/mod/standard/set/self/recent.rb +25 -17
- data/mod/standard/set/self/search.rb +25 -4
- data/mod/standard/set/type/cardtype.rb +11 -9
- data/mod/standard/set/type/date.rb +1 -1
- data/mod/standard/set/type/number.rb +1 -1
- data/mod/standard/set/type/phrase.rb +1 -1
- data/mod/standard/set/type/search_type.rb +17 -282
- data/mod/standard/set/type/session.rb +1 -1
- data/mod/standard/set/type/set.rb +155 -131
- data/mod/standard/set/type/toggle.rb +1 -1
- data/mod/standard/set/type/uri.rb +4 -4
- data/mod/standard/spec/chunk/include_spec.rb +13 -31
- data/mod/standard/spec/chunk/link_spec.rb +1 -1
- data/mod/standard/spec/set/all/error_spec.rb +1 -1
- data/mod/standard/spec/set/all/history_spec.rb +2 -2
- data/mod/standard/spec/set/all/rich_html/form_spec.rb +4 -4
- data/mod/standard/spec/set/all/rich_html/toolbar_spec.rb +22 -0
- data/mod/standard/spec/set/all/rich_html/wrapper_spec.rb +3 -2
- data/mod/standard/spec/set/right/when_created_spec.rb +1 -1
- data/mod/standard/spec/set/right/when_last_edited_spec.rb +1 -1
- data/mod/standard/spec/set/rstar/rules_spec.rb +2 -3
- data/mod/standard/spec/set/self/head_spec.rb +2 -2
- data/mod/standard/spec/set/self/navbox_spec.rb +1 -1
- data/mod/standard/spec/set/self/now_spec.rb +1 -1
- data/mod/standard/spec/set/type/date_spec.rb +1 -1
- data/mod/standard/spec/set/type/email_template_spec.rb +1 -1
- data/mod/standard/spec/set/type/layout_type_spec.rb +1 -1
- data/mod/standard/spec/set/type/number_spec.rb +1 -1
- data/mod/standard/spec/set/type/phrase_spec.rb +1 -1
- data/mod/standard/spec/set/type/search_type_spec.rb +2 -2
- data/mod/standard/spec/set/type/set_spec.rb +2 -2
- data/mod/standard/spec/set/type/toggle_spec.rb +2 -2
- data/mod/standard/spec/set/type/uri_spec.rb +3 -1
- data/mod/tinymce_editor/set/abstract/tinymce_editor.rb +1 -1
- data/spec/config/initializers/core_extensions_spec.rb +40 -10
- data/spec/lib/card/auth_spec.rb +8 -8
- data/spec/lib/card/cache_spec.rb +3 -3
- data/spec/lib/card/chunk_spec.rb +4 -4
- data/spec/lib/card/codename_spec.rb +2 -2
- data/spec/lib/card/content_spec.rb +23 -23
- data/spec/lib/card/diff_spec.rb +1 -1
- data/spec/lib/card/format_spec.rb +19 -24
- data/spec/lib/card/loader_spec.rb +4 -4
- data/spec/lib/card/name_spec.rb +16 -16
- data/spec/lib/card/query_spec.rb +80 -80
- data/spec/lib/card/reference_spec.rb +5 -5
- data/spec/lib/card/set_spec.rb +6 -6
- data/spec/lib/card/subcards_spec.rb +14 -0
- data/spec/lib/card/view_cache_spec.rb +5 -5
- data/spec/models/card/cardtype_spec.rb +15 -15
- data/spec/models/card/create_spec.rb +2 -2
- data/spec/models/card/trash_spec.rb +24 -24
- data/spec/models/card/type_transition_spec.rb +8 -8
- data/spec/models/card/validation_spec.rb +5 -5
- data/spec/models/card_spec.rb +14 -14
- data/spec/spec_helper.rb +6 -2
- data/spec/support/card_spec_helper.rb +21 -11
- data/spec/support/helper/card_helper.rb +11 -4
- metadata +73 -15
- data/lib/card/cache/view_cache.rb +0 -103
- data/mod/bootstrap/set/all/bootstrap/layout.rb +0 -58
- data/mod/core/set/all/view_cache.rb +0 -9
@@ -1,45 +1,46 @@
|
|
1
1
|
format :html do
|
2
|
-
def
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
title: "Sign up",
|
9
|
-
hidden: {
|
10
|
-
success: (card.rule(:thanks) || "_self"),
|
11
|
-
"card[type_id]" => card.type_id
|
12
|
-
}
|
13
|
-
)
|
14
|
-
return unless Auth.signed_in? && args[:account].confirm_ok?
|
15
|
-
invite_args args
|
2
|
+
def invitation?
|
3
|
+
if @invitation.nil?
|
4
|
+
@invitation = Auth.signed_in? && args[:account].confirm_ok?
|
5
|
+
else
|
6
|
+
@invitation
|
7
|
+
end
|
16
8
|
end
|
17
9
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
args[:hidden][:success] = "_self"
|
10
|
+
view :new do
|
11
|
+
voo.title = invitation? ? "Invite" : "Sign up"
|
12
|
+
super()
|
22
13
|
end
|
23
14
|
|
24
|
-
|
25
|
-
|
15
|
+
def default_name_formgroup_args _args
|
16
|
+
voo.help = "usually first and last name"
|
17
|
+
end
|
18
|
+
|
19
|
+
view :content_formgroup do
|
20
|
+
[account_formgroups, (card.structure ? edit_slot : "")].join
|
21
|
+
end
|
26
22
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
23
|
+
def hidden_success override=nil
|
24
|
+
override = card.rule(:thanks) unless invitation?
|
25
|
+
super override
|
26
|
+
end
|
27
|
+
|
28
|
+
view :new_buttons do
|
29
|
+
button_formgroup do
|
30
|
+
[standard_submit_button, invite_button].compact
|
34
31
|
end
|
35
32
|
end
|
36
33
|
|
37
|
-
|
38
|
-
|
39
|
-
|
34
|
+
def invite_button
|
35
|
+
return unless invitation?
|
36
|
+
button_tag "Send Invitation", situation: "primary"
|
37
|
+
end
|
38
|
+
|
39
|
+
def account_formgroups
|
40
|
+
account = card.fetch trait: :account, new: {}
|
40
41
|
Auth.as_bot do
|
41
|
-
subformat(
|
42
|
-
end
|
42
|
+
subformat(account)._render :content_formgroup, structure: true
|
43
|
+
end
|
43
44
|
end
|
44
45
|
|
45
46
|
view :core do |_args|
|
@@ -6,30 +6,41 @@ attr_accessor :email
|
|
6
6
|
format :html do
|
7
7
|
view :setup, tags: :unknown_ok,
|
8
8
|
perms: ->(_r) { Auth.needs_setup? } do |args|
|
9
|
-
|
9
|
+
voo.title = "Welcome, Wagneer!"
|
10
|
+
voo.show! :help
|
11
|
+
voo.hide! :menu
|
12
|
+
|
10
13
|
Auth.as_bot do
|
11
|
-
frame_and_form :create
|
14
|
+
frame_and_form :create do
|
12
15
|
[
|
16
|
+
setup_hidden_fields,
|
17
|
+
|
13
18
|
_render_name_formgroup(help: "usually first and last name"),
|
14
|
-
|
15
|
-
|
19
|
+
account_formgroup,
|
20
|
+
setup_form_buttons
|
16
21
|
]
|
17
22
|
end
|
18
23
|
end
|
19
24
|
end
|
20
25
|
|
21
|
-
def
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
26
|
+
def setup_form_buttons
|
27
|
+
button_formgroup { setup_button }
|
28
|
+
end
|
29
|
+
|
30
|
+
def account_formgroup
|
31
|
+
account = card.fetch trait: :account, new: {}
|
32
|
+
subformat(account)._render :content_formgroup, structure: true
|
33
|
+
end
|
34
|
+
|
35
|
+
def setup_button
|
36
|
+
submit_button text: "Set up", disable_with: "Setting up"
|
37
|
+
end
|
38
|
+
|
39
|
+
def setup_hidden_fields
|
40
|
+
hidden_tags(
|
41
|
+
setup: true,
|
42
|
+
success: "REDIRECT: #{Card.path_setting '/'}",
|
43
|
+
"card[type_id]" => Card.default_accounted_type_id
|
33
44
|
)
|
34
45
|
end
|
35
46
|
|
@@ -38,15 +49,11 @@ format :html do
|
|
38
49
|
if Card.config.action_mailer.perform_deliveries == false
|
39
50
|
text += <<-HTML
|
40
51
|
<br>WARNING: Email delivery is turned off.
|
41
|
-
Change settings in config/application.rb to send sign up notifications.
|
52
|
+
Change settings in config/application.rb to send sign up notifications.
|
42
53
|
HTML
|
43
54
|
end
|
44
55
|
text
|
45
56
|
end
|
46
|
-
|
47
|
-
def setup_button
|
48
|
-
submit_button text: "Set up", disable_with: "Setting up"
|
49
|
-
end
|
50
57
|
end
|
51
58
|
|
52
59
|
event :setup_as_bot, before: :check_permissions, on: :create,
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
describe Card::Set::All::Account do
|
4
4
|
describe "accountable?" do
|
5
|
-
it "
|
5
|
+
it "is false for cards with *accountable rule off" do
|
6
6
|
expect(Card["A"].accountable?).to eq(false)
|
7
7
|
end
|
8
8
|
|
9
|
-
it "
|
9
|
+
it "is true for cards with *accountable rule on" do
|
10
10
|
Card::Auth.as_bot do
|
11
11
|
Card.create name: "A+*self+*accountable", content: "1"
|
12
12
|
Card.create name: "*account+*right+*create",
|
@@ -35,11 +35,11 @@ describe Card::Set::All::Account do
|
|
35
35
|
@parties = @joe_user_card.parties # note: must be called to test resets
|
36
36
|
end
|
37
37
|
|
38
|
-
it "
|
38
|
+
it "initially has only auth and self " do
|
39
39
|
expect(@parties).to eq([Card::AnyoneSignedInID, @joe_user_card.id])
|
40
40
|
end
|
41
41
|
|
42
|
-
it "
|
42
|
+
it "updates when new roles are set" do
|
43
43
|
roles_card = @joe_user_card.fetch trait: :roles, new: {}
|
44
44
|
r1 = Card["r1"]
|
45
45
|
|
@@ -68,13 +68,13 @@ describe Card::Set::All::Account do
|
|
68
68
|
end
|
69
69
|
|
70
70
|
describe "among?" do
|
71
|
-
it "
|
71
|
+
it "is true for self" do
|
72
72
|
expect(Card::Auth.current.among?([Card::Auth.current_id])).to be_truthy
|
73
73
|
end
|
74
74
|
end
|
75
75
|
|
76
76
|
describe "+*email" do
|
77
|
-
it "
|
77
|
+
it "creates a card and account card" do
|
78
78
|
jadmin = Card["joe admin"]
|
79
79
|
Card::Auth.current_id = jadmin.id
|
80
80
|
# simulate login to get correct from address
|
@@ -98,19 +98,19 @@ describe Card::Set::All::Account do
|
|
98
98
|
@card = Card["Joe User"]
|
99
99
|
end
|
100
100
|
|
101
|
-
it "
|
101
|
+
it "handles email updates" do
|
102
102
|
@card.update_attributes! "+*account" => { "+*email" => "joe@user.co.uk" }
|
103
103
|
expect(@card.account.email).to eq("joe@user.co.uk")
|
104
104
|
end
|
105
105
|
|
106
|
-
it "
|
106
|
+
it "lets Wagn Bot block accounts" do
|
107
107
|
Card::Auth.as_bot do
|
108
108
|
@card.account.status_card.update_attributes! content: "blocked"
|
109
109
|
expect(@card.account.blocked?).to be_truthy
|
110
110
|
end
|
111
111
|
end
|
112
112
|
|
113
|
-
it "
|
113
|
+
it "does not allow a user to block or unblock himself" do
|
114
114
|
expect do
|
115
115
|
@card.account.status_card.update_attributes! content: "blocked"
|
116
116
|
end.to raise_error(ActiveRecord::RecordInvalid,
|
@@ -16,13 +16,13 @@ describe Card::Set::Right::Account do
|
|
16
16
|
end
|
17
17
|
end
|
18
18
|
|
19
|
-
it "
|
19
|
+
it "creates an authenticable password" do
|
20
20
|
validity = Card::Auth.password_valid? @user_card.account, "tmp_pass"
|
21
21
|
expect(validity).to be_truthy
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
-
it "
|
25
|
+
it "checks accountability of 'accounted' card" do
|
26
26
|
@unaccountable = Card.create(
|
27
27
|
name: "BasicUnaccountable",
|
28
28
|
"+*account" => {
|
@@ -34,7 +34,7 @@ describe Card::Set::Right::Account do
|
|
34
34
|
expect(error_msg).to eq("not allowed on this card")
|
35
35
|
end
|
36
36
|
|
37
|
-
it "
|
37
|
+
it "requires email" do
|
38
38
|
@no_email = Card.create(
|
39
39
|
name: "TmpUser",
|
40
40
|
type_id: Card::UserID,
|
@@ -63,8 +63,11 @@ describe Card::Set::Right::Account do
|
|
63
63
|
end
|
64
64
|
|
65
65
|
it "contains link to verify account" do
|
66
|
-
|
67
|
-
|
66
|
+
raw_source = @mail.parts[0].body.raw_source
|
67
|
+
["/update/#{@account.left.cardname.url_key}",
|
68
|
+
"token=#{@account.token}"].each do |url_part|
|
69
|
+
expect(raw_source).to include(url_part)
|
70
|
+
end
|
68
71
|
end
|
69
72
|
|
70
73
|
it "contains expiry days" do
|
@@ -87,10 +90,16 @@ describe Card::Set::Right::Account do
|
|
87
90
|
expect(body).to match(Card.global_setting(:title))
|
88
91
|
end
|
89
92
|
|
90
|
-
it "contains password
|
93
|
+
it "contains password reset link" do
|
94
|
+
raw_source = @mail.parts[0].body.raw_source
|
91
95
|
token = @account.token_card.refresh(true).content
|
92
|
-
|
93
|
-
|
96
|
+
["/update/#{@account.left.cardname.url_key}",
|
97
|
+
"token=#{token}",
|
98
|
+
"live_token=true",
|
99
|
+
"event=reset_password"].each do |url_part|
|
100
|
+
|
101
|
+
expect(raw_source).to include(url_part)
|
102
|
+
end
|
94
103
|
end
|
95
104
|
|
96
105
|
it "contains expiry days" do
|
@@ -104,13 +113,13 @@ describe Card::Set::Right::Account do
|
|
104
113
|
@account = Card::Auth.find_account_by_email("joe@user.com")
|
105
114
|
end
|
106
115
|
|
107
|
-
it "
|
116
|
+
it "resets password" do
|
108
117
|
@account.password_card.update_attributes!(content: "new password")
|
109
118
|
authenticated = Card::Auth.authenticate "joe@user.com", "new password"
|
110
119
|
assert_equal @account, authenticated
|
111
120
|
end
|
112
121
|
|
113
|
-
it "
|
122
|
+
it "does not rehash password when updating email" do
|
114
123
|
@account.email_card.update_attributes! content: "joe2@user.com"
|
115
124
|
authenticated = Card::Auth.authenticate "joe2@user.com", "joe_pass"
|
116
125
|
assert_equal @account, authenticated
|
@@ -128,15 +137,15 @@ describe Card::Set::Right::Account do
|
|
128
137
|
Card::Auth.current_id = Card::AnonymousID
|
129
138
|
end
|
130
139
|
|
131
|
-
it "
|
140
|
+
it "authenticates with correct token" do
|
132
141
|
expect(Card::Auth.current_id).to eq(Card::AnonymousID)
|
133
142
|
expect(@account.save).to eq(true)
|
134
143
|
expect(Card::Auth.current_id).to eq(@account.left_id)
|
135
144
|
@account = @account.refresh true
|
136
|
-
expect(@account.fetch(trait: :token)).to be_nil
|
145
|
+
# expect(@account.fetch(trait: :token)).to be_nil
|
137
146
|
end
|
138
147
|
|
139
|
-
it "
|
148
|
+
it "does not work if token is expired" do
|
140
149
|
@account.token_card.update_column :updated_at,
|
141
150
|
3.days.ago.strftime("%F %T")
|
142
151
|
@account.token_card.expire
|
@@ -152,7 +161,7 @@ describe Card::Set::Right::Account do
|
|
152
161
|
# user notified of expired token
|
153
162
|
end
|
154
163
|
|
155
|
-
it "
|
164
|
+
it "does not work if token is wrong" do
|
156
165
|
Card::Env.params[:token] = @token + "xxx"
|
157
166
|
Card::Env.params[:event] = "reset_password"
|
158
167
|
@account.save
|
@@ -7,19 +7,19 @@ describe Card::Set::Right::Email do
|
|
7
7
|
@format = @card.format
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "allows Wagn Bot to read" do
|
11
11
|
Card::Auth.as_bot do
|
12
12
|
expect(@format.render_raw).to eq("u1@user.com")
|
13
13
|
end
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "allows self to read" do
|
17
17
|
Card::Auth.as Card["u1"] do
|
18
18
|
expect(@format.render_raw).to eq("u1@user.com")
|
19
19
|
end
|
20
20
|
end
|
21
21
|
|
22
|
-
it "
|
22
|
+
it "hides from other users" do
|
23
23
|
expect(@card.ok?(:read)).to be_falsey
|
24
24
|
expect(@format.render_raw).to match(/denied/)
|
25
25
|
end
|
@@ -31,20 +31,20 @@ describe Card::Set::Right::Email do
|
|
31
31
|
@email_card = Card["u1"].account.email_card
|
32
32
|
end
|
33
33
|
|
34
|
-
it "
|
34
|
+
it "downcases email" do
|
35
35
|
Card::Auth.as_bot do
|
36
36
|
@email_card.update_attributes! content: "QuIrE@example.com"
|
37
37
|
expect(@email_card.content).to eq("quire@example.com")
|
38
38
|
end
|
39
39
|
end
|
40
40
|
|
41
|
-
it "
|
41
|
+
it "requires valid email" do
|
42
42
|
@email_card.update_attributes content: "boop"
|
43
43
|
expect(@email_card.errors[:content].first)
|
44
44
|
.to match(/must be valid address/)
|
45
45
|
end
|
46
46
|
|
47
|
-
it "
|
47
|
+
it "requires unique email" do
|
48
48
|
@email_card.update_attributes content: "joe@user.com"
|
49
49
|
expect(@email_card.errors[:content].first).to match(/must be unique/)
|
50
50
|
end
|
@@ -6,21 +6,21 @@ describe Card::Set::Right::Password do
|
|
6
6
|
end
|
7
7
|
|
8
8
|
describe "#update_attributes" do
|
9
|
-
it "
|
9
|
+
it "encrypts password" do
|
10
10
|
@account.password_card.update_attributes! content: "new password"
|
11
11
|
expect(@account.password).not_to eq("new password")
|
12
12
|
authenticated = Card::Auth.authenticate "joe@user.com", "new password"
|
13
13
|
assert_equal @account, authenticated
|
14
14
|
end
|
15
15
|
|
16
|
-
it "
|
16
|
+
it "validates password" do
|
17
17
|
password_card = @account.password_card
|
18
18
|
password_card.update_attributes content: "2b"
|
19
19
|
expect(password_card.errors[:password]).not_to be_empty
|
20
20
|
end
|
21
21
|
|
22
22
|
context "blank password" do
|
23
|
-
it "
|
23
|
+
it "does not change the password" do
|
24
24
|
acct = @account
|
25
25
|
original_pw = acct.password
|
26
26
|
expect(original_pw.size).to be > 10
|
@@ -30,7 +30,7 @@ describe Card::Set::Right::Password do
|
|
30
30
|
expect(original_pw).to eq(pw_card.refresh(_force = true).content)
|
31
31
|
end
|
32
32
|
|
33
|
-
it "
|
33
|
+
it "does not break email editing" do
|
34
34
|
@account.update_attributes! subcards: { "+*password" => "",
|
35
35
|
"+*email" => "joe2@user.com" }
|
36
36
|
expect(@account.email).to eq("joe2@user.com")
|
@@ -5,17 +5,17 @@ describe Card::Set::Right::Token do
|
|
5
5
|
@token = Card["Anonymous+*account"].fetch trait: :token, new: {}
|
6
6
|
end
|
7
7
|
|
8
|
-
it "
|
8
|
+
it "gets expiration from configuration by default" do
|
9
9
|
expect(@token.term).to eq(Card.config.token_expiry)
|
10
10
|
end
|
11
11
|
|
12
|
-
it "
|
12
|
+
it "gets expiration from card if it exists" do
|
13
13
|
@token.expiration = "3 days"
|
14
14
|
expect(@token.term).to eq(3.days)
|
15
15
|
expect(@token.permanent?).to be false
|
16
16
|
end
|
17
17
|
|
18
|
-
it '
|
18
|
+
it 'is permanent if expiration is "none"' do
|
19
19
|
@token.expiration = "none"
|
20
20
|
expect(@token.term).to eq("permanent")
|
21
21
|
expect(@token.permanent?).to be true
|
@@ -2,9 +2,9 @@
|
|
2
2
|
|
3
3
|
describe Card::Set::Self::AccountLinks do
|
4
4
|
it "has a 'my card' link" do
|
5
|
-
|
6
|
-
|
7
|
-
assert_select 'a[
|
5
|
+
account_links = render_card :core, name: "*account links"
|
6
|
+
assert_view_select account_links, 'span[id="logging"]' do
|
7
|
+
assert_select 'a[class=~"my-card-link"]', text: "Joe User"
|
8
8
|
end
|
9
9
|
end
|
10
10
|
end
|
@@ -55,13 +55,13 @@ describe Card::Set::Self::Signin do
|
|
55
55
|
Card::Env.params[:reset_password] = true
|
56
56
|
end
|
57
57
|
|
58
|
-
it "
|
58
|
+
it "is triggered by an update" do
|
59
59
|
# Card['joe admin'].account.token.should be_nil FIXME - this should be t
|
60
60
|
@card.update_attributes! "+*email" => "joe@admin.com"
|
61
61
|
expect(Card["joe admin"].account.token).not_to be_nil
|
62
62
|
end
|
63
63
|
|
64
|
-
it "
|
64
|
+
it "returns an error if email is not found" do
|
65
65
|
@card.update_attributes "+*email" => "schmoe@admin.com"
|
66
66
|
expect(@card.errors[:email].first).to match(/not recognized/)
|
67
67
|
end
|