LoginEntrypoint.vala 792 B

1234567891011121314151617181920212223242526
  1. using Statum;
  2. using Spry;
  3. namespace {{NS}} {
  4. public class LoginPagePublic : Object {
  5. public Statum.Model.ActionDto login { get; set; }
  6. }
  7. /**
  8. * Entrypoint for /login: hydrates the page slot with the login action
  9. * reference; already-authenticated visitors bounce home.
  10. */
  11. public class LoginEntrypoint : StatumEntrypoint {
  12. public override async DirectiveBuilder handle() throws GLib.Error {
  13. if (!SpryAuth.current(request).is_anonymous) {
  14. return directives().navigate("/");
  15. }
  16. var page = new LoginPagePublic();
  17. page.login = action_registry.author<Spry.Actions.LoginAction>();
  18. return directives().set_typed<LoginPagePublic>("page", Scope.PAGE, page);
  19. }
  20. }
  21. }