Require tokens
@@ -1061,7 +1061,7 @@ async fn listen_test_application_submit_requests(
}]
async fn listen_application_submit_requests(
rqctx: Arc<RequestContext<Context>>,
- _auth: Bearer<InternalToken>,
+ _auth: Bearer<HiringToken>,
body_param: TypedBody<cio_api::application_form::ApplicationForm>,
) -> Result<HttpResponseAccepted<String>, HttpError> {
let body = body_param.into_inner();
@@ -1259,10 +1259,9 @@ async fn listen_application_files_upload_requests(
});
log::info!("Application materials upload token consume result {:?}", token_result);
- } else {
- log::info!("Application materials submission does not contain upload token");
- }
+ match token_result {
+ Ok(_) => {
// Check the origin header. In the future this may be upgraded to a hard failure
let origin_access = crate::cors::get_cors_origin_header(
rqctx.clone(),
@@ -1302,6 +1301,16 @@ async fn listen_application_files_upload_requests(
}
}
}
+ Err(err) => {
+ txn.finish(err.status_code);
+ Err(err)
+ }
+ }
+ } else {
+ txn.finish(http::StatusCode::UNAUTHORIZED);
+ Err(HttpError::for_status(None, http::StatusCode::UNAUTHORIZED))
+ }
+}
/**
* Listen for rows created in our Airtable workspace.
