From af20b86d84e069636ef0f0bddb4ac625b1bfd9ca Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Wed, 8 Apr 2015 15:55:53 +0200 Subject: [PATCH] Added auto wizard to frontend. --- .../app/controllers/getting_started.js.coffee | 11 ++++++++++ app/controllers/getting_started_controller.rb | 20 +++++++++++++++++++ contrib/auto_wizzard_example.json | 18 ++++++++++------- 3 files changed, 42 insertions(+), 7 deletions(-) diff --git a/app/assets/javascripts/app/controllers/getting_started.js.coffee b/app/assets/javascripts/app/controllers/getting_started.js.coffee index eb54808d4..c7c6c480f 100644 --- a/app/assets/javascripts/app/controllers/getting_started.js.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.js.coffee @@ -36,6 +36,17 @@ class Index extends App.ControllerContent @navigate '#login' return + # check if auto wizzard is executed + if data.auto_wizzard == true + + # login check / get session user + App.Auth.loginCheck() + + if App.Config.get('system_online_service') + @navigate 'getting_started/agents' + else + @navigate 'getting_started/channel' + # check if import is active if data.import_mode == true @navigate '#import/' + data.import_backend diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index fae0dceab..1278afc26 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -34,6 +34,26 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # check if first user already exists return if setup_done_response + # check it auto wizard is already done + auto_wizzard_admin = AutoWizzard.setup + if auto_wizzard_admin + + # set current session user + current_user_set(auto_wizzard_admin) + + # set system init to done + Setting.set( 'system_init_done', true ) + + render :json => { + :auto_wizzard => true, + :setup_done => setup_done, + :import_mode => Setting.get('import_mode'), + :import_backend => Setting.get('import_backend'), + :system_online_service => Setting.get('system_online_service'), + } + return + end + # if master user already exists, we need to be authenticated if setup_done return if !authentication_check diff --git a/contrib/auto_wizzard_example.json b/contrib/auto_wizzard_example.json index 351e99c32..3ce43a700 100644 --- a/contrib/auto_wizzard_example.json +++ b/contrib/auto_wizzard_example.json @@ -1,27 +1,31 @@ { "Users": [ { - "login": "nicole.braun@zammad.org", - "firstname": "Nicole", - "lastname": "Braun", - "email": "nicole.braun@zammad.org", + "login": "hans.atila@zammad.org", + "firstname": "Hans", + "lastname": "Atila", + "email": "hans.atila@zammad.org", "password": "Z4mm4dr0ckZ!" } ], "Settings": [ { "name": "developer_mode", - "value": "true" + "value": true }, { "name": "product_name", "value": "Zammad Demo System" + }, + { + "name": "system_online_service", + "value": true } ], "EmailAddresses": [ { "realname": "Zammad Demo System", - "email": "zammad@localhost", + "email": "zammad@localhost" } ] -} \ No newline at end of file +}