update deps, switch to newest rocket version
This commit is contained in:
@ -359,10 +359,10 @@ impl<'r> FromRequest<'r> for User {
|
||||
Ok(user_id) => {
|
||||
let db = req.rocket().state::<SqlitePool>().unwrap();
|
||||
let Some(user) = User::find_by_id(db, user_id).await else {
|
||||
return Outcome::Failure((Status::Unauthorized, LoginError::UserNotFound));
|
||||
return Outcome::Error((Status::Unauthorized, LoginError::UserNotFound));
|
||||
};
|
||||
if user.deleted {
|
||||
return Outcome::Failure((Status::Unauthorized, LoginError::UserDeleted));
|
||||
return Outcome::Error((Status::Unauthorized, LoginError::UserDeleted));
|
||||
}
|
||||
user.logged_in(db).await;
|
||||
|
||||
@ -374,10 +374,10 @@ impl<'r> FromRequest<'r> for User {
|
||||
}
|
||||
Err(_) => {
|
||||
println!("{:?}", user_id.value());
|
||||
Outcome::Failure((Status::Unauthorized, LoginError::DeserializationError))
|
||||
Outcome::Error((Status::Unauthorized, LoginError::DeserializationError))
|
||||
}
|
||||
},
|
||||
None => Outcome::Failure((Status::Unauthorized, LoginError::NotLoggedIn)),
|
||||
None => Outcome::Error((Status::Unauthorized, LoginError::NotLoggedIn)),
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -414,9 +414,9 @@ impl<'r> FromRequest<'r> for TechUser {
|
||||
match User::from_request(req).await {
|
||||
Outcome::Success(user) => match user.try_into() {
|
||||
Ok(user) => Outcome::Success(user),
|
||||
Err(_) => Outcome::Failure((Status::Unauthorized, LoginError::NotACox)),
|
||||
Err(_) => Outcome::Error((Status::Unauthorized, LoginError::NotACox)),
|
||||
},
|
||||
Outcome::Failure(f) => Outcome::Failure(f),
|
||||
Outcome::Error(f) => Outcome::Error(f),
|
||||
Outcome::Forward(f) => Outcome::Forward(f),
|
||||
}
|
||||
}
|
||||
@ -454,9 +454,9 @@ impl<'r> FromRequest<'r> for CoxUser {
|
||||
match User::from_request(req).await {
|
||||
Outcome::Success(user) => match user.try_into() {
|
||||
Ok(user) => Outcome::Success(user),
|
||||
Err(_) => Outcome::Failure((Status::Unauthorized, LoginError::NotACox)),
|
||||
Err(_) => Outcome::Error((Status::Unauthorized, LoginError::NotACox)),
|
||||
},
|
||||
Outcome::Failure(f) => Outcome::Failure(f),
|
||||
Outcome::Error(f) => Outcome::Error(f),
|
||||
Outcome::Forward(f) => Outcome::Forward(f),
|
||||
}
|
||||
}
|
||||
@ -487,9 +487,9 @@ impl<'r> FromRequest<'r> for AdminUser {
|
||||
match User::from_request(req).await {
|
||||
Outcome::Success(user) => match user.try_into() {
|
||||
Ok(user) => Outcome::Success(user),
|
||||
Err(_) => Outcome::Failure((Status::Unauthorized, LoginError::NotAnAdmin)),
|
||||
Err(_) => Outcome::Error((Status::Unauthorized, LoginError::NotAnAdmin)),
|
||||
},
|
||||
Outcome::Failure(f) => Outcome::Failure(f),
|
||||
Outcome::Error(f) => Outcome::Error(f),
|
||||
Outcome::Forward(f) => Outcome::Forward(f),
|
||||
}
|
||||
}
|
||||
@ -520,9 +520,9 @@ impl<'r> FromRequest<'r> for NonGuestUser {
|
||||
match User::from_request(req).await {
|
||||
Outcome::Success(user) => match user.try_into() {
|
||||
Ok(user) => Outcome::Success(user),
|
||||
Err(_) => Outcome::Failure((Status::Unauthorized, LoginError::NotAnAdmin)),
|
||||
Err(_) => Outcome::Error((Status::Unauthorized, LoginError::NotAnAdmin)),
|
||||
},
|
||||
Outcome::Failure(f) => Outcome::Failure(f),
|
||||
Outcome::Error(f) => Outcome::Error(f),
|
||||
Outcome::Forward(f) => Outcome::Forward(f),
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user