MCPcopy Create free account
hub / github.com/docusealco/docuseal / create

Method create

app/controllers/setup_controller.rb:17–47  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

15 end
16
17 def create
18 @account = Account.new(account_params)
19 @account.timezone = Accounts.normalize_timezone(@account.timezone)
20 @user = @account.users.new(user_params)
21 @encrypted_config = EncryptedConfig.new(encrypted_config_params)
22
23 unless URI.parse(encrypted_config_params[:value].to_s).class.in?([URI::HTTP, URI::HTTPS])
24 @encrypted_config.errors.add(:value, I18n.t('should_be_a_valid_url'))
25
26 return render :index, status: :unprocessable_content
27 end
28
29 return render :index, status: :unprocessable_content unless @account.valid?
30
31 if @user.save
32 encrypted_configs = [
33 { key: EncryptedConfig::APP_URL_KEY, value: encrypted_config_params[:value] },
34 { key: EncryptedConfig::ESIGN_CERTS_KEY, value: GenerateCertificate.call.transform_values(&:to_pem) }
35 ]
36 @account.encrypted_configs.create!(encrypted_configs)
37 @account.account_configs.create!(key: :fulltext_search, value: true) if SearchEntry.table_exists?
38
39 Docuseal.refresh_default_url_options!
40
41 sign_in(@user)
42
43 redirect_to newsletter_path
44 else
45 render :index, status: :unprocessable_content
46 end
47 end
48
49 private
50

Callers 15

calculator.jsFile · 0.45
constructorMethod · 0.45
normalizeMethod · 0.45
clearMethod · 0.45
evaluateStrictMethod · 0.45
createBlockNodeFunction · 0.45
dynamic_editor.jsFile · 0.45
buildDecorationsFunction · 0.45
handleTextInputFunction · 0.45
buildEditorFunction · 0.45
blockNodeFunction · 0.45
attrsMarkFunction · 0.45

Calls 5

normalize_timezoneMethod · 0.80
saveMethod · 0.80
newMethod · 0.45
callMethod · 0.45

Tested by

no test coverage detected