using Spry; using Spry.Authentication; using Statum; namespace ClankerSaddle { /** Public data of the login page's `page` slot. */ public class LoginPagePublic : Object { public Statum.Model.ActionDto login { get; set; } } /** * Entrypoint for /login: hydrates the page slot with the * {@link LoginAction} reference; authenticated visitors are sent * straight to the dashboard. */ public class LoginEntrypoint : StatumEntrypoint { public override async DirectiveBuilder handle() throws GLib.Error { if (!SpryAuth.current(request).is_anonymous) { return directives().navigate("/"); } var page = new LoginPagePublic(); page.login = action_registry.author(); return directives().set_typed("page", Scope.PAGE, page); } } }