exit(0);
}
- if (!auth_login(username, password)) {
+ char *token = auth_login(username, password);
+ if (token == NULL) {
respond_JSON_Failure();
exit(0);
}
- char *token = auth_get_token(username);
printf("Set-Cookie: auth=%s\r\n", token);
free(token);
if (!check_auth(username))
exit(0);
- auth_logout(username);
+ const char *given_token = cgi_getcookie("auth");
+ auth_logout(username, given_token);
respond_JSON_Success();
} else if (strncmp(path, "/subscribe", 10) == 0 || strncmp(path, "/unsubscribe", 12) == 0) {
const char *username = cgi_getentrystr("username");