From 430af38fa65ca3c82443d128021790208fefe37d Mon Sep 17 00:00:00 2001
From: fbsanchez <fborja.sanchez@artica.es>
Date: Mon, 11 Nov 2019 13:38:27 +0100
Subject: [PATCH] minor fixes in flow control

---
 pandora_console/godmode/agentes/agent_manager.php     |  2 +-
 pandora_console/include/class/WelcomeWindow.class.php | 10 +++++++---
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/pandora_console/godmode/agentes/agent_manager.php b/pandora_console/godmode/agentes/agent_manager.php
index d6b9448576..2516e0c5f8 100644
--- a/pandora_console/godmode/agentes/agent_manager.php
+++ b/pandora_console/godmode/agentes/agent_manager.php
@@ -275,7 +275,7 @@ if ($new_agent) {
 
 $table_alias = '<div class="label_select"><p class="input_label">'.__('Alias').': '.ui_print_help_tip(__('Characters /,\,|,%,#,&,$ will be ignored'), true).'</p>';
 $table_alias .= '<div class='.$label_select_parent.'>';
-$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true).'</div>';
+$table_alias .= '<div class='.$label_select_child_left.'>'.html_print_input_text('alias', $alias, '', 50, 100, true, false, true).'</div>';
 if ($new_agent) {
     $table_alias .= '<div class="label_select_child_right">'.html_print_checkbox_switch('alias_as_name', 1, $config['alias_as_name'], true).__('Use alias as name').'</div>';
 }
diff --git a/pandora_console/include/class/WelcomeWindow.class.php b/pandora_console/include/class/WelcomeWindow.class.php
index 86ed9d2b26..951e1f7986 100644
--- a/pandora_console/include/class/WelcomeWindow.class.php
+++ b/pandora_console/include/class/WelcomeWindow.class.php
@@ -211,7 +211,13 @@ class WelcomeWindow extends Wizard
         $this->step = $config['welcome_state'];
 
         // Get step available.
-        if (empty($config['welcome_id_agent']) === true) {
+        if (empty($config['welcome_mail_configured']) === true
+            && get_parameter('sec2') == 'godmode/setup/setup'
+            && get_parameter('section', '') == 'general'
+            && get_parameter('update_config', false) !== false
+        ) {
+            $this->step = W_CONFIGURE_MAIL;
+        } else if (empty($config['welcome_id_agent']) === true) {
             $this->step = W_CREATE_AGENT;
         } else if (empty($config['welcome_module']) === true) {
             $this->step = W_CREATE_MODULE;
@@ -219,8 +225,6 @@ class WelcomeWindow extends Wizard
             $this->step = W_CREATE_ALERT;
         } else if (empty($config['welcome_task']) === true) {
             $this->step = W_CREATE_TASK;
-        } else if (empty($config['welcome_mail_configured']) === true) {
-            $this->step = W_CONFIGURE_MAIL;
         }
 
         return $this->step;