feat: carry the register input on RegisterEvent and export the registration steps

- RegisterEvent.Payload: a copy of the register input without password and
  password_confirmation (Winter's golem15.user.register data array)
- RegisterUser, RegisterOptions, FireRegisterEvent, IssueToken and APIArray:
  the steps POST /register runs, now called by Register itself; its status
  codes and bodies are unchanged
- README documents the exports and Payload
This commit is contained in:
Jakub Zych
2026-10-03 07:12:00 +02:00
parent c258e9fade
commit d80d7990f6
5 changed files with 235 additions and 42 deletions

View File

@@ -16,7 +16,14 @@ func (e *GetApiArrayEvent) Collected() map[string]any {
return e.data
}
// RegisterEvent is fired after a user row is created. No listener consumes it yet.
// RegisterEvent is fired after a user row is created (Winter's
// golem15.user.register).
type RegisterEvent struct {
User *models.User
// Payload is a copy of the register input, mirroring the data array
// Winter passes with golem15.user.register, so a listener can read
// extra keys a client sent (an invitation token, for example).
// password and password_confirmation are never included, in plaintext
// or hashed. Listeners must treat it as read-only input.
Payload map[string]any
}