From 1af073b4e8a3638a8dcea7732737edb6c6f5bc4e Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 16 Jan 2017 02:16:14 +0100 Subject: [PATCH] Fixed issue #462 - Setup asks for FQDN, but doesn't write to DB. --- app/controllers/getting_started_controller.rb | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index a843535c7..2dcdd646b 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -114,22 +114,33 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # validate url messages = {} + settings = {} if !Setting.get('system_online_service') if !params[:url] || params[:url] !~ %r{^(http|https)://.+?$} messages[:url] = 'A URL looks like http://zammad.example.com' end + + # split url in http_type and fqdn + if params[:url] + if params[:url] =~ %r{^(http|https)://(.+?)(:.+?|/.+?|)$} + settings[:http_type] = $1 + settings[:fqdn] = $2 + else + messages[:url] = 'A URL looks like http://zammad.example.com' + end + end end # validate organization if !params[:organization] || params[:organization].empty? messages[:organization] = 'Invalid!' + else + settings[:organization] = params[:organization] end # validate image if params[:logo] && params[:logo] =~ /^data:image/i - file = StaticAssets.data_url_attributes(params[:logo]) - if !file[:content] || !file[:mime_type] messages[:logo] = 'Unable to process image upload.' end @@ -143,21 +154,6 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} return end - # split url in http_type and fqdn - settings = {} - if !Setting.get('system_online_service') - if params[:url] =~ %r{/^(http|https)://(.+?)(:.+?|/.+?|)$} - Setting.set('http_type', $1) - settings[:http_type] = $1 - Setting.set('fqdn', $2) - settings[:fqdn] = $2 - end - end - - # save organization - Setting.set('organization', params[:organization]) - settings[:organization] = params[:organization] - # save image if params[:logo] && params[:logo] =~ /^data:image/i