fix: dont require auth to check invite information
This commit is contained in:
parent
d102966198
commit
29dbb085a2
1 changed files with 1 additions and 12 deletions
|
@ -1,27 +1,16 @@
|
||||||
use actix_web::{HttpRequest, HttpResponse, get, post, web};
|
use actix_web::{HttpRequest, HttpResponse, get, post, web};
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
Data,
|
api::v1::auth::check_access_token, error::Error, structs::{Guild, Invite, Member}, utils::{get_auth_header, global_checks}, Data
|
||||||
api::v1::auth::check_access_token,
|
|
||||||
error::Error,
|
|
||||||
structs::{Guild, Invite, Member},
|
|
||||||
utils::get_auth_header,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
#[get("{id}")]
|
#[get("{id}")]
|
||||||
pub async fn get(
|
pub async fn get(
|
||||||
req: HttpRequest,
|
|
||||||
path: web::Path<(String,)>,
|
path: web::Path<(String,)>,
|
||||||
data: web::Data<Data>,
|
data: web::Data<Data>,
|
||||||
) -> Result<HttpResponse, Error> {
|
) -> Result<HttpResponse, Error> {
|
||||||
let headers = req.headers();
|
|
||||||
|
|
||||||
let auth_header = get_auth_header(headers)?;
|
|
||||||
|
|
||||||
let mut conn = data.pool.get().await?;
|
let mut conn = data.pool.get().await?;
|
||||||
|
|
||||||
check_access_token(auth_header, &mut conn).await?;
|
|
||||||
|
|
||||||
let invite_id = path.into_inner().0;
|
let invite_id = path.into_inner().0;
|
||||||
|
|
||||||
let invite = Invite::fetch_one(&mut conn, invite_id).await?;
|
let invite = Invite::fetch_one(&mut conn, invite_id).await?;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue