RegisterEntrypoint.vala 819 B

1234567891011121314151617181920212223242526
  1. using Statum;
  2. using Spry;
  3. namespace {{NS}} {
  4. public class RegisterPagePublic : Object {
  5. public Statum.Model.ActionDto register { get; set; }
  6. }
  7. /**
  8. * Entrypoint for /register: hydrates the page slot with the register
  9. * action reference; already-authenticated visitors bounce home.
  10. */
  11. public class RegisterEntrypoint : 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 RegisterPagePublic();
  17. page.register = action_registry.author<Spry.Actions.RegisterAction>();
  18. return directives().set_typed<RegisterPagePublic>("page", Scope.PAGE, page);
  19. }
  20. }
  21. }