From 851f0ef91252428e8ac27d33b8103bb6ccb612c0 Mon Sep 17 00:00:00 2001 From: Martin Edenhofer Date: Mon, 17 Nov 2014 11:35:36 +0100 Subject: [PATCH] Fixed several small bugs. --- .../app/controllers/getting_started.js.coffee | 16 ++++--- .../app/views/getting_started/channel.jst.eco | 6 +-- app/controllers/getting_started_controller.rb | 47 ++++++++++--------- db/seeds.rb | 2 +- 4 files changed, 38 insertions(+), 33 deletions(-) diff --git a/app/assets/javascripts/app/controllers/getting_started.js.coffee b/app/assets/javascripts/app/controllers/getting_started.js.coffee index 650846215..bd6749ffb 100644 --- a/app/assets/javascripts/app/controllers/getting_started.js.coffee +++ b/app/assets/javascripts/app/controllers/getting_started.js.coffee @@ -143,11 +143,6 @@ class Admin extends App.ControllerContent } ) @Config.set('system_init_done', true) - App.Event.trigger 'notify', { - type: 'success' - msg: App.i18n.translateContent( 'Welcome to %s!', @Config.get('product_name') ) - timeout: 2500 - } fail: (data) => @formEnable(e) @@ -540,7 +535,7 @@ class ChannelEmail extends App.ControllerContent @enable(e) ) - verify: (account) => + verify: (account, count = 0) => @showSlide('js-verify') @hideAlert('js-verify') @@ -555,7 +550,14 @@ class ChannelEmail extends App.ControllerContent if data.result is 'ok' @navigate 'getting_started/agents' else - @showAlert('js-verify', data.message_human || data.message ) + if count is 1 + @showAlert('js-verify', data.message_human || data.message ) + @delay( + => @showSlide('js-inbound') + 2300 + ) + else + @verify( @account, count + 1 ) @enable(e) fail: => @enable(e) diff --git a/app/assets/javascripts/app/views/getting_started/channel.jst.eco b/app/assets/javascripts/app/views/getting_started/channel.jst.eco index d246149d6..1fcd5c5e8 100644 --- a/app/assets/javascripts/app/views/getting_started/channel.jst.eco +++ b/app/assets/javascripts/app/views/getting_started/channel.jst.eco @@ -8,10 +8,10 @@
<% for adapter in @adapters: %> - +
<%- @T( adapter.name ) %>
+ <% end %>
diff --git a/app/controllers/getting_started_controller.rb b/app/controllers/getting_started_controller.rb index fe54cef7b..4c475d8a6 100644 --- a/app/controllers/getting_started_controller.rb +++ b/app/controllers/getting_started_controller.rb @@ -198,7 +198,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # probe inbound result = email_probe_inbound( settings[:inbound] ) - if !result + if result[:result] != 'ok' render :json => result return end @@ -355,7 +355,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} puts "PROBE: #{config.inspect}" result = email_probe_inbound( config ) puts "RESULT: #{result.inspect}" - if !result + if result[:result] == 'ok' success = true settings[:inbound] = config break @@ -539,14 +539,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # connection test result = email_probe_outbound( params, params[:email] ) - if result[:result] != 'ok' - render :json => result - return - end - # return result render :json => { - :result => 'ok', + :result => result } end @@ -565,14 +560,9 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # connection test result = email_probe_inbound( params ) - if result - render :json => result - return - end - render :json => { - :result => 'ok', - } + render :json => result + return end def email_verify @@ -683,10 +673,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} # test connection translationMap = { - 'authentication failed' => 'Authentication failed!', + 'authentication failed' => 'Authentication failed!', 'getaddrinfo: nodename nor servname provided, or not known' => 'Hostname not found!', - 'No route to host' => 'No route to host!', - 'Connection refused' => 'Connection refused!', + 'No route to host' => 'No route to host!', + 'Connection refused' => 'Connection refused!', } if params[:adapter] == 'smtp' begin @@ -711,6 +701,7 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} if e.message =~ /#{Regexp.escape(key)}/i result = { :result => 'ok', + :notice => e.message, } return result end @@ -728,7 +719,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } return result end - return + result = { + :result => 'ok', + } + return result end begin @@ -755,7 +749,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } return result end - return + result = { + :result => 'ok', + } + return result end def email_probe_inbound(params) @@ -789,7 +786,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } return result end - return + result = { + :result => 'ok', + } + return result end begin @@ -808,7 +808,10 @@ curl http://localhost/api/v1/getting_started -v -u #{login}:#{password} } return result end - return + result = { + :result => 'ok', + } + return result end def mxers(domain) diff --git a/db/seeds.rb b/db/seeds.rb index 3ac2e4064..b67f44ed5 100644 --- a/db/seeds.rb +++ b/db/seeds.rb @@ -49,7 +49,7 @@ Setting.create_if_not_exists( }, ], }, - :state => 'Example Inc.', + :state => '', :frontend => true )