feat: mail service

This commit is contained in:
Ilia Denisov
2026-04-17 18:39:16 +02:00
committed by GitHub
parent 23ffcb7535
commit 5b7593e6f6
183 changed files with 31215 additions and 248 deletions
+9 -4
View File
@@ -22,6 +22,9 @@ type LoginCodeDelivery struct {
// Code stores the cleartext login code requested by authsession.
Code string
// Locale stores the canonical BCP 47 language tag selected by authsession.
Locale string
}
// MailBehavior overrides one external mail-stub response.
@@ -100,8 +103,9 @@ func (s *MailStub) handle(writer http.ResponseWriter, request *http.Request) {
}
var payload struct {
Email string `json:"email"`
Code string `json:"code"`
Email string `json:"email"`
Code string `json:"code"`
Locale string `json:"locale"`
}
if err := decodeStrictJSONRequest(request, &payload); err != nil {
http.Error(writer, err.Error(), http.StatusBadRequest)
@@ -110,8 +114,9 @@ func (s *MailStub) handle(writer http.ResponseWriter, request *http.Request) {
s.mu.Lock()
s.deliveries = append(s.deliveries, LoginCodeDelivery{
Email: payload.Email,
Code: payload.Code,
Email: payload.Email,
Code: payload.Code,
Locale: payload.Locale,
})
behavior := s.behavior
s.mu.Unlock()