Sha256: 09de0b832da61882c2d018821bd44bd85eb2acc07752982809958cb485267f51
Contents?: true
Size: 1.58 KB
Versions: 3
Compression:
Stored size: 1.58 KB
Contents
include_set Abstract::Accountable attr_accessor :email format :html do view :setup, unknown: true, perms: ->(_fmt) { Auth.needs_setup? } do with_nest_mode :edit do voo.title = "Your deck is ready to go!" # LOCALIZE voo.show! :help voo.hide! :menu voo.help = haml :setup_help Auth.as_bot { setup_form } end end def setup_form frame_and_form :create do [ setup_hidden_fields, _render_name_formgroup, account_formgroups, setup_form_buttons ] end end def setup_form_buttons button_formgroup { setup_button } end def setup_button submit_button text: "Set up", disable_with: "Setting up" end def setup_hidden_fields hidden_tags( setup: true, success: { redirect: true, mark: path(mark: "") }, "card[type_id]" => Card.default_accounted_type_id ) end end def setup? Card::Env.params[:setup] end event :setup_as_bot, before: :check_permissions, on: :create, when: :setup? do abort :failure unless Auth.needs_setup? Auth.as_bot # we need bot authority to set the initial administrator roles # this is granted and inspected here as a separate event for # flexibility and security when configuring initial setups end event :setup_first_user, :prepare_to_store, on: :create, when: :setup? do subcard "signup alert email+*to", content: name subfield :roles, content: roles_for_first_user end def roles_for_first_user %i[help_desk shark administrator].map(&:cardname) end event :signin_after_setup, :integrate, on: :create, when: :setup? do Auth.signin id end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
card-mod-account-0.14.2 | set/type/user.rb |
card-mod-account-0.14.1 | set/type/user.rb |
card-mod-account-0.14.0 | set/type/user.rb |