Skip to content
This repository was archived by the owner on Aug 5, 2025. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/cookies.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ impl<'r> FromRequest<'r> for Session {
if let Some(session) = get_session(cookies) {
Outcome::Success(session)
} else {
Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError))
Outcome::Error((Status::Unauthorized, Error::UnauthorizedError))
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/user/auth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ impl<'r> FromRequest<'r> for Auth<'r> {
let users: &State<Users> = if let Outcome::Success(users) = req.guard().await {
users
} else {
return Outcome::Failure((Status::InternalServerError, Error::UnmanagedStateError));
return Outcome::Error((Status::InternalServerError, Error::UnmanagedStateError));
};

Outcome::Success(Auth {
Expand Down
8 changes: 4 additions & 4 deletions src/user/user_impl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,13 +113,13 @@ impl<'r> FromRequest<'r> for User {
let guard = request.guard().await;
let auth: Auth = match guard {
Success(auth) => auth,
Failure(x) => return Failure(x),
Error(x) => return Error(x),
Forward(x) => return Forward(x),
};
if let Some(user) = auth.get_user().await {
Outcome::Success(user)
} else {
Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError))
Outcome::Error((Status::Unauthorized, Self::Error::UnauthorizedError))
}
}
}
Expand All @@ -132,15 +132,15 @@ impl<'r> FromRequest<'r> for AdminUser {
let guard = request.guard().await;
let auth: Auth = match guard {
Success(auth) => auth,
Failure(x) => return Failure(x),
Error(x) => return Error(x),
Forward(x) => return Forward(x),
};
if let Some(user) = auth.get_user().await {
if user.is_admin {
return Outcome::Success(AdminUser(user));
}
}
Outcome::Failure((Status::Unauthorized, Error::UnauthorizedError))
Outcome::Error((Status::Unauthorized, Self::Error::UnauthorizedError))
}
}

Expand Down