prevents the deletion of vehicles of other users
This commit is contained in:
parent
c941e1bccf
commit
3709eddabb
|
@ -92,6 +92,11 @@ def edit_vehicle(vid):
|
||||||
@login_required
|
@login_required
|
||||||
def delete_vehicle(vid):
|
def delete_vehicle(vid):
|
||||||
vehicle = Vehicle.query.filter(Vehicle.id == vid).first()
|
vehicle = Vehicle.query.filter(Vehicle.id == vid).first()
|
||||||
|
|
||||||
|
# prevent deletion of foreign vehicles
|
||||||
|
if not vehicle in current_user.vehicles:
|
||||||
|
return redirect(url_for('get_account_page'))
|
||||||
|
|
||||||
form = DeleteVehicleForm()
|
form = DeleteVehicleForm()
|
||||||
|
|
||||||
if form.validate_on_submit():
|
if form.validate_on_submit():
|
||||||
|
@ -216,4 +221,4 @@ def prepare_pit_stops(pss):
|
||||||
curr_date = curr['date']
|
curr_date = curr['date']
|
||||||
curr['days'] = (curr_date - last_date).days
|
curr['days'] = (curr_date - last_date).days
|
||||||
pitstops.reverse()
|
pitstops.reverse()
|
||||||
return pitstops
|
return pitstops
|
||||||
|
|
Loading…
Reference in New Issue