Skip to content

Commit 0b0a9b0

Browse files
authored
Merge pull request #249 from oleg-umnik/tokadd
Pass user token back to portal
2 parents 21d6f9c + d24245f commit 0b0a9b0

File tree

1 file changed

+9
-7
lines changed

1 file changed

+9
-7
lines changed

src/auth.c

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -199,8 +199,8 @@ authenticate_client(request * r)
199199
"Got DENIED from central server authenticating token %s from %s at %s - deleting from firewall and redirecting them to denied message",
200200
client->token, client->ip, client->mac);
201201
fw_deny(client);
202-
safe_asprintf(&urlFragment, "%smessage=%s",
203-
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_DENIED);
202+
safe_asprintf(&urlFragment, "%smessage=%s&token=%s",
203+
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_DENIED, client->token);
204204
http_send_redirect_to_auth(r, urlFragment, "Redirect to denied message");
205205
free(urlFragment);
206206
break;
@@ -210,8 +210,8 @@ authenticate_client(request * r)
210210
debug(LOG_INFO, "Got VALIDATION from central server authenticating token %s from %s at %s"
211211
"- adding to firewall and redirecting them to activate message", client->token, client->ip, client->mac);
212212
fw_allow(client, FW_MARK_PROBATION);
213-
safe_asprintf(&urlFragment, "%smessage=%s",
214-
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_ACTIVATE_ACCOUNT);
213+
safe_asprintf(&urlFragment, "%smessage=%s&token=%s",
214+
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_ACTIVATE_ACCOUNT, client->token);
215215
http_send_redirect_to_auth(r, urlFragment, "Redirect to activate message");
216216
free(urlFragment);
217217
break;
@@ -222,7 +222,8 @@ authenticate_client(request * r)
222222
"adding to firewall and redirecting them to portal", client->token, client->ip, client->mac);
223223
fw_allow(client, FW_MARK_KNOWN);
224224
served_this_session++;
225-
safe_asprintf(&urlFragment, "%sgw_id=%s", auth_server->authserv_portal_script_path_fragment, config->gw_id);
225+
safe_asprintf(&urlFragment, "%sgw_id=%s&token=%s", auth_server->authserv_portal_script_path_fragment,
226+
config->gw_id, client->token);
226227
http_send_redirect_to_auth(r, urlFragment, "Redirect to portal");
227228
free(urlFragment);
228229
break;
@@ -231,8 +232,9 @@ authenticate_client(request * r)
231232
/* Client had X minutes to validate account by email and didn't = too late */
232233
debug(LOG_INFO, "Got VALIDATION_FAILED from central server authenticating token %s from %s at %s "
233234
"- redirecting them to failed_validation message", client->token, client->ip, client->mac);
234-
safe_asprintf(&urlFragment, "%smessage=%s",
235-
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_ACCOUNT_VALIDATION_FAILED);
235+
safe_asprintf(&urlFragment, "%smessage=%s&token=%s",
236+
auth_server->authserv_msg_script_path_fragment, GATEWAY_MESSAGE_ACCOUNT_VALIDATION_FAILED,
237+
client->token);
236238
http_send_redirect_to_auth(r, urlFragment, "Redirect to failed validation message");
237239
free(urlFragment);
238240
break;

0 commit comments

Comments
 (0)