don't allow registration for own events
This commit is contained in:
parent
48c9a481cc
commit
38d8197a48
@ -38,6 +38,25 @@ async fn register(
|
||||
);
|
||||
}
|
||||
|
||||
if let Some(cox_id) = register.cox_id {
|
||||
let trip = trip::Entity::find_by_id(cox_id)
|
||||
.one(db.inner())
|
||||
.await
|
||||
.unwrap()
|
||||
.unwrap();
|
||||
if trip.user_id == user.id {
|
||||
log::warn!(
|
||||
"{} tried to register for his own trip ({})",
|
||||
user.name,
|
||||
trip.id
|
||||
);
|
||||
return Flash::error(
|
||||
Redirect::to("/"),
|
||||
"Du kannst an deinen eigenen Ausfahrten nicht teilnehmen...",
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
let user = user::Model::find_or_create_user(®ister.name, db.inner()).await;
|
||||
|
||||
let day = format!("{}", day.day.format("%Y-%m-%d"));
|
||||
|
Loading…
Reference in New Issue
Block a user