forked from Ruderverein-Donau-Linz/rowt
update deps, switch to newest rocket version
This commit is contained in:
parent
6db40f4d79
commit
144bcefcab
406
Cargo.lock
generated
406
Cargo.lock
generated
File diff suppressed because it is too large
Load Diff
@ -9,8 +9,8 @@ rowing-tera = ["rocket_dyn_templates", "tera"]
|
|||||||
rest = []
|
rest = []
|
||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
rocket = { version = "0.5.0-rc.3", features = ["secrets"]}
|
rocket = { version = "0.5.0-rc.4", features = ["secrets"]}
|
||||||
rocket_dyn_templates = {version = "0.1.0-rc.3", features = [ "tera" ], optional = true }
|
rocket_dyn_templates = {version = "0.1.0-rc.4", features = [ "tera" ], optional = true }
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
env_logger = "0.10"
|
env_logger = "0.10"
|
||||||
sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls", "macros", "chrono", "time"] }
|
sqlx = { version = "0.6", features = ["sqlite", "runtime-tokio-rustls", "macros", "chrono", "time"] }
|
||||||
|
@ -359,10 +359,10 @@ impl<'r> FromRequest<'r> for User {
|
|||||||
Ok(user_id) => {
|
Ok(user_id) => {
|
||||||
let db = req.rocket().state::<SqlitePool>().unwrap();
|
let db = req.rocket().state::<SqlitePool>().unwrap();
|
||||||
let Some(user) = User::find_by_id(db, user_id).await else {
|
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 {
|
if user.deleted {
|
||||||
return Outcome::Failure((Status::Unauthorized, LoginError::UserDeleted));
|
return Outcome::Error((Status::Unauthorized, LoginError::UserDeleted));
|
||||||
}
|
}
|
||||||
user.logged_in(db).await;
|
user.logged_in(db).await;
|
||||||
|
|
||||||
@ -374,10 +374,10 @@ impl<'r> FromRequest<'r> for User {
|
|||||||
}
|
}
|
||||||
Err(_) => {
|
Err(_) => {
|
||||||
println!("{:?}", user_id.value());
|
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 {
|
match User::from_request(req).await {
|
||||||
Outcome::Success(user) => match user.try_into() {
|
Outcome::Success(user) => match user.try_into() {
|
||||||
Ok(user) => Outcome::Success(user),
|
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),
|
Outcome::Forward(f) => Outcome::Forward(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -454,9 +454,9 @@ impl<'r> FromRequest<'r> for CoxUser {
|
|||||||
match User::from_request(req).await {
|
match User::from_request(req).await {
|
||||||
Outcome::Success(user) => match user.try_into() {
|
Outcome::Success(user) => match user.try_into() {
|
||||||
Ok(user) => Outcome::Success(user),
|
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),
|
Outcome::Forward(f) => Outcome::Forward(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,9 +487,9 @@ impl<'r> FromRequest<'r> for AdminUser {
|
|||||||
match User::from_request(req).await {
|
match User::from_request(req).await {
|
||||||
Outcome::Success(user) => match user.try_into() {
|
Outcome::Success(user) => match user.try_into() {
|
||||||
Ok(user) => Outcome::Success(user),
|
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),
|
Outcome::Forward(f) => Outcome::Forward(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -520,9 +520,9 @@ impl<'r> FromRequest<'r> for NonGuestUser {
|
|||||||
match User::from_request(req).await {
|
match User::from_request(req).await {
|
||||||
Outcome::Success(user) => match user.try_into() {
|
Outcome::Success(user) => match user.try_into() {
|
||||||
Ok(user) => Outcome::Success(user),
|
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),
|
Outcome::Forward(f) => Outcome::Forward(f),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -141,7 +141,7 @@ async fn updatepw(
|
|||||||
|
|
||||||
#[get("/logout")]
|
#[get("/logout")]
|
||||||
fn logout(cookies: &CookieJar<'_>, _user: User) -> Flash<Redirect> {
|
fn logout(cookies: &CookieJar<'_>, _user: User) -> Flash<Redirect> {
|
||||||
cookies.remove_private(Cookie::named("loggedin_user"));
|
cookies.remove_private(Cookie::from("loggedin_user"));
|
||||||
|
|
||||||
Flash::success(Redirect::to("/auth"), "Logout erfolgreich")
|
Flash::success(Redirect::to("/auth"), "Logout erfolgreich")
|
||||||
}
|
}
|
||||||
|
@ -35,7 +35,7 @@ impl<'r> FromRequest<'r> for KioskCookie {
|
|||||||
async fn from_request(request: &'r Request<'_>) -> request::Outcome<KioskCookie, Self::Error> {
|
async fn from_request(request: &'r Request<'_>) -> request::Outcome<KioskCookie, Self::Error> {
|
||||||
match request.cookies().get_private("kiosk") {
|
match request.cookies().get_private("kiosk") {
|
||||||
Some(cookie) => request::Outcome::Success(KioskCookie(cookie.value().to_string())),
|
Some(cookie) => request::Outcome::Success(KioskCookie(cookie.value().to_string())),
|
||||||
None => request::Outcome::Forward(()),
|
None => request::Outcome::Forward(rocket::http::Status::SeeOther),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user