diff --git a/source/calendarwebapp.d b/source/calendarwebapp.d index 1c2b7d4..745e5d3 100644 --- a/source/calendarwebapp.d +++ b/source/calendarwebapp.d @@ -22,12 +22,12 @@ import vibe.web.web : errorDisplay, noRoute, redirect, render, SessionVar, @requiresAuth class CalendarWebapp { - @noRoute AuthInfo authenticate(scope HTTPServerRequest req, scope HTTPServerResponse res) @trusted + @noRoute AuthInfo authenticate(scope HTTPServerRequest req, scope HTTPServerResponse res) @safe { if (!req.session || !req.session.isKeySet("auth")) { - redirect("/login"); - throw new HTTPStatusException(HTTPStatus.forbidden, "Du musst dich erst einloggen"); + () @trusted{ redirect("/login"); }(); + return AuthInfo.init; } return req.session.get!AuthInfo("auth"); } diff --git a/views/layout.dt b/views/layout.dt index 5cabeff..b15f0ad 100644 --- a/views/layout.dt +++ b/views/layout.dt @@ -8,5 +8,3 @@ html block navigation include navigation block content - -