From 9ac19f108c1b69025572bf32e310b332ef098c98 Mon Sep 17 00:00:00 2001 From: Jeffrey Armstrong Date: Wed, 12 May 2021 13:05:42 -0400 Subject: Fixed post query processing caused by sloppiness. Adding a player via the web interface now works. --- captain/web.f90 | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) (limited to 'captain/web.f90') diff --git a/captain/web.f90 b/captain/web.f90 index 57f57f9..dab017a 100644 --- a/captain/web.f90 +++ b/captain/web.f90 @@ -288,7 +288,7 @@ contains end if res = trim(res)//new_line(' ')//"

Management

"// & - new_line(' ')//'
'// & + new_line(' ')//''// & '
' end function generate_players_html @@ -644,12 +644,12 @@ contains end function request_templated function handle_post(req) result(resp) + use captain_db, only: add_player_db use page_template - use config, only: template_filepath, project + use config, only: template_filepath use logging use server_response, only:request, response - use http, only: HTTP_CODE_SUCCESS, HTTP_CODE_NOTFOUND - use request_utils, only: get_job_page_title, handle_instruction_command + use http, only: HTTP_CODE_FAILURE, HTTP_CODE_SUCCESS use http_post_utilities use query_utilities, only: query implicit none @@ -664,6 +664,8 @@ contains character(64)::category, second posted = read_post_contents() + call write_log("Post Contents: "//posted%full, LOG_DEBUG) + if(posted%component_count() > 0) then ! We will immediately redirect after the command is handled @@ -674,13 +676,15 @@ contains call req%path_component(1, category) if(trim(category) == "players") then call req%path_component(2, second) + call write_log("Handling command for players: "//trim(second), LOG_INFO) ! Add a player if(trim(second) == "add.html") then + call add_player_db(posted%get_value("name")) call page%assign('destination', 'players.html') - + end if end if @@ -693,12 +697,13 @@ contains resp%temporary_file = .true. resp%body_filename => page%output_filename resp%body_mimetype = "text/html" + resp%code = HTTP_CODE_SUCCESS call posted%destroy() else - resp%code = 500 + resp%code = HTTP_CODE_FAILURE end if @@ -726,6 +731,7 @@ contains resp = request_static(req) else if(req%is_post()) then + call write_log("POST operation", LOG_INFO) resp = handle_post(req) else -- cgit v1.2.3