diff --git a/app/controllers/accounts_controller.rb b/app/controllers/accounts_controller.rb index 523dcf71..60d8acd8 100644 --- a/app/controllers/accounts_controller.rb +++ b/app/controllers/accounts_controller.rb @@ -16,7 +16,15 @@ class AccountsController < ApplicationController @encrypted_config = EncryptedConfig.find_or_initialize_by(account: current_account, key: EncryptedConfig::APP_URL_KEY) - @encrypted_config.update!(app_url_params) + @encrypted_config.assign_attributes(app_url_params) + + unless URI.parse(@encrypted_config.value.to_s).class.in?([URI::HTTP, URI::HTTPS]) + @encrypted_config.errors.add(:value, 'should be a valid URL') + + return render :show, status: :unprocessable_entity + end + + @encrypted_config.save! Docuseal.refresh_default_url_options! diff --git a/app/controllers/setup_controller.rb b/app/controllers/setup_controller.rb index 2b42cc9d..3c89e34d 100644 --- a/app/controllers/setup_controller.rb +++ b/app/controllers/setup_controller.rb @@ -19,6 +19,13 @@ class SetupController < ApplicationController @user = @account.users.new(user_params) + unless URI.parse(encrypted_config_params[:value].to_s).class.in?([URI::HTTP, URI::HTTPS]) + @encrypted_config = EncryptedConfig.new(encrypted_config_params) + @encrypted_config.errors.add(:value, 'should be a valid URL') + + return render :index, status: :unprocessable_entity + end + if @user.save encrypted_configs = [ { key: EncryptedConfig::APP_URL_KEY, value: encrypted_config_params[:value] }, diff --git a/app/views/dashboard/index.html.erb b/app/views/dashboard/index.html.erb index 5d39e8d6..6af153d5 100644 --- a/app/views/dashboard/index.html.erb +++ b/app/views/dashboard/index.html.erb @@ -49,10 +49,10 @@
Streamline document workflows, from creating customizable templates to filling and signing document forms, with DocuSeal
+Streamline document workflows, from creating customizable templates to filling and signing document forms
<%= link_to new_template_path, class: 'base-button', data: { turbo_frame: :modal } do %> <%= svg_icon('plus', class: 'w-6 h-6 stroke-2') %> - Create Template + Create Template <% end %>
- Source code is available under github.com/docusealhq.
Open-source contributors are always ready to help!
+ Source code is available under github.com/docusealco.
Open-source contributors are always ready to help!