push
This commit is contained in:
@ -13,14 +13,18 @@ struct RegisterForm {
|
||||
}
|
||||
|
||||
#[put("/", data = "<register>")]
|
||||
async fn register(db: &State<DatabaseConnection>, register: Form<RegisterForm>) -> Redirect {
|
||||
async fn register(
|
||||
db: &State<DatabaseConnection>,
|
||||
register: Form<RegisterForm>,
|
||||
user: user::Model,
|
||||
) -> Redirect {
|
||||
let day = day::Entity::find_by_id(*register.day)
|
||||
.one(db.inner())
|
||||
.await
|
||||
.unwrap()
|
||||
.expect("There's no trip on this date (yet)");
|
||||
|
||||
if !day.open_registration {
|
||||
if !(day.open_registration || user.is_cox) {
|
||||
return Redirect::to("/");
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user