[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[taler-challenger] branch master updated: reply with SPA on authorize re
From: |
gnunet |
Subject: |
[taler-challenger] branch master updated: reply with SPA on authorize request |
Date: |
Wed, 03 Jul 2024 20:35:57 +0200 |
This is an automated email from the git hooks/post-receive script.
sebasjm pushed a commit to branch master
in repository challenger.
The following commit(s) were added to refs/heads/master by this push:
new 324e6d5 reply with SPA on authorize request
324e6d5 is described below
commit 324e6d5575c33af15fe368165407b6292b696df0
Author: Sebastian <sebasjm@gmail.com>
AuthorDate: Wed Jul 3 15:35:51 2024 -0300
reply with SPA on authorize request
---
src/challenger/challenger-httpd.c | 1 -
src/challenger/challenger-httpd_authorize.c | 67 ++++++++++++++---------------
2 files changed, 33 insertions(+), 35 deletions(-)
diff --git a/src/challenger/challenger-httpd.c
b/src/challenger/challenger-httpd.c
index b7316cd..84384ea 100644
--- a/src/challenger/challenger-httpd.c
+++ b/src/challenger/challenger-httpd.c
@@ -35,7 +35,6 @@
#include "challenger-httpd_token.h"
#include "challenger-httpd_spa.h"
#include "challenger_database_lib.h"
-#include <taler/taler_templating_lib.h>
/**
diff --git a/src/challenger/challenger-httpd_authorize.c
b/src/challenger/challenger-httpd_authorize.c
index 5b7d8c8..c18edb0 100644
--- a/src/challenger/challenger-httpd_authorize.c
+++ b/src/challenger/challenger-httpd_authorize.c
@@ -24,6 +24,7 @@
#include <taler/taler_templating_lib.h>
#include "challenger-httpd_authorize.h"
#include "challenger-httpd_common.h"
+#include "challenger-httpd_spa.h"
/**
@@ -232,17 +233,37 @@ CH_handler_authorize (struct CH_HandlerContext *hc,
case GNUNET_DB_STATUS_SUCCESS_ONE_RESULT:
break;
}
+ if (0 == CH_get_output_type (hc->connection))
+ {
+ const char *prev_full_url = hc->full_url;
+
+ const char *rparams = strchr (hc->full_url, '?');
+ if (NULL == rparams)
+ GNUNET_asprintf (&hc->full_url,
+ "%s?nonce=%s",
+ prev_full_url,
+ hc->path);
+
+ else
+ GNUNET_asprintf (&hc->full_url,
+ "%s&nonce=%s",
+ prev_full_url,
+ hc->path);
+
+ GNUNET_log (GNUNET_ERROR_TYPE_INFO,
+ "Redirect before %s now `%s'\n",
+ prev_full_url,
+ hc->full_url);
+
+ GNUNET_free (prev_full_url);
+ return CH_spa_redirect (hc, NULL, 0);
+ }
{
enum GNUNET_GenericReturnValue ret;
json_t *args;
- char *form;
struct MHD_Response *resp;
- unsigned int http_status;
MHD_RESULT res;
- GNUNET_asprintf (&form,
- "enter-%s-form",
- CH_address_type);
args = GNUNET_JSON_PACK (
GNUNET_JSON_pack_bool ("fix_address",
0 == address_attempts_left),
@@ -256,46 +277,24 @@ CH_handler_authorize (struct CH_HandlerContext *hc,
GNUNET_JSON_pack_uint64 ("auth_attempts_left",
auth_attempts_left),
GNUNET_JSON_pack_timestamp ("retransmission_time",
- GNUNET_TIME_absolute_to_timestamp(
+ GNUNET_TIME_absolute_to_timestamp (
GNUNET_TIME_absolute_add (
last_tx_time,
CH_validation_duration))),
GNUNET_JSON_pack_uint64 ("changes_left",
address_attempts_left)
);
- http_status = MHD_HTTP_OK;
- if (0 == CH_get_output_type (hc->connection))
- {
- ret = TALER_TEMPLATING_build (
- hc->connection,
- &http_status,
- form,
- NULL,
- NULL,
- args,
- &resp);
- GNUNET_free (form);
- json_decref (args);
- if (GNUNET_SYSERR == ret)
- {
- GNUNET_break (0);
- return MHD_NO;
- }
- GNUNET_break (GNUNET_OK == ret);
- }
- else
- {
- GNUNET_break (0 ==
- json_object_del (args,
- "nonce"));
- resp = TALER_MHD_make_json_steal (args);
- }
+
+ GNUNET_break (0 ==
+ json_object_del (args,
+ "nonce"));
+ resp = TALER_MHD_make_json_steal (args);
GNUNET_break (MHD_YES ==
MHD_add_response_header (resp,
MHD_HTTP_HEADER_CACHE_CONTROL,
"no-store,no-cache"));
res = MHD_queue_response (hc->connection,
- http_status,
+ MHD_HTTP_OK,
resp);
MHD_destroy_response (resp);
return res;
--
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [taler-challenger] branch master updated: reply with SPA on authorize request,
gnunet <=