diff --git a/pandora_console/godmode/users/configure_token.php b/pandora_console/godmode/users/configure_token.php index 6b2f796edf..45cc887b4d 100644 --- a/pandora_console/godmode/users/configure_token.php +++ b/pandora_console/godmode/users/configure_token.php @@ -122,7 +122,7 @@ $table->data[1][1] = html_print_input_text( 50, 255, true -); +).html_print_input_hidden('today_date', date('Y-m-d'), true); $table->data[1][2] = __('Expiration Time'); $table->data[1][3] = html_print_input_text( @@ -132,9 +132,9 @@ $table->data[1][3] = html_print_input_text( 50, 255, true -); +).html_print_input_hidden('today_time', date('H:i:s'), true); -echo '
'; +echo ''; html_print_table($table); @@ -143,7 +143,7 @@ $actionButtons = []; if (empty($id_token) === true) { $actionButtons[] = html_print_submit_button( __('Create'), - 'crt', + 'next', false, ['icon' => 'wand'], true @@ -152,7 +152,7 @@ if (empty($id_token) === true) { } else { $actionButtons[] = html_print_submit_button( __('Update'), - 'upd', + 'next', false, ['icon' => 'update'], true @@ -201,4 +201,41 @@ ui_require_jquery_file('ui.datepicker-'.get_user_language(), 'include/javascript closeText: '' }); }); + + function errordate() { + confirmDialog({ + title: "", + message: "", + hideCancelButton: true, + }); + } + + $('#button-next').on('click', function() { + event.preventDefault(); + var date = $('#text-date-expiration').val(); + var time = date+' '+$('#text-time-expiration').val(); + if (date !== '' && $('#text-time-expiration').val() !== '') { + if (date < $('#hidden-today_date').val() || time < $('#hidden-today_date').val()+' '+$('#hidden-today_time').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + } else if (date !== '' && time === ' ') { + if (date < $('#hidden-today_date').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + } else if (date === '' && time !== ' ') { + errordate(); + } else if (date !== '' && $('#text-time-expiration').val() === '') { + if (date < $('#hidden-today_date').val()) { + errordate(); + } else{ + $('#form_token').submit(); + } + }else { + $('#form_token').submit(); + } + }) diff --git a/pandora_console/godmode/users/token_list.php b/pandora_console/godmode/users/token_list.php index f8c198e3b1..27d93076b9 100644 --- a/pandora_console/godmode/users/token_list.php +++ b/pandora_console/godmode/users/token_list.php @@ -77,10 +77,13 @@ if ($create_token === true || $update_token === true) { $expirationDate = get_parameter('date-expiration', null); $expirationTime = get_parameter('time-expiration', null); $validity = null; + if (empty($expirationDate) === false) { $validity = $expirationDate; if (empty($expirationTime) === false) { $validity .= ' '.$expirationTime; + } else { + $validity .= ' 23:59:59'; } } diff --git a/pandora_console/include/functions_ui.php b/pandora_console/include/functions_ui.php index c03936ac32..f60db0b560 100755 --- a/pandora_console/include/functions_ui.php +++ b/pandora_console/include/functions_ui.php @@ -436,7 +436,7 @@ function ui_print_message($message, $class='', $attributes='', $return=false, $t $_SESSION['info_box_count']++; } - $position = (20 + ((int) $_SESSION['info_box_count'] * 100)); + $position = (20 + (int) $_SESSION['info_box_count'] + 120); $output = html_print_div( [