Fix comment auth

This commit is contained in:
Laura Hausmann 2022-05-21 13:33:16 +02:00
parent 8675da426a
commit daf0e97da4
Signed by: zotan
GPG key ID: D044E84C5BE01605

View file

@ -54,8 +54,9 @@ public class TripModel : PageModel {
if (!Request.Form.ContainsKey("comment"))
return;
AuthorizedUser = db.Users.FirstOrDefault(p => p.Username == AuthUtil.GetRemoteUser(HttpContext, db));
var leg = db.Legs.First(p => p.LegId == int.Parse(Request.Form["id"]));
if (leg.UserId != AuthorizedUser.UserId)
if (leg.UserId != AuthorizedUser!.UserId)
return;
leg.Comment = Request.Form["comment"];