fixed verification code

This commit is contained in:
Stephan D
2026-02-09 16:40:52 +01:00
parent f8a3bef2e6
commit eda6b75f74
78 changed files with 1118 additions and 487 deletions

View File

@@ -7,10 +7,10 @@ import (
"go.uber.org/zap"
)
func (a *NotificationAPI) onAccount(context context.Context, account *model.Account) error {
func (a *NotificationAPI) onAccount(context context.Context, account *model.Account, token string) error {
var link string
var err error
if link, err = a.dp.GetFullLink("verify", account.VerifyToken); err != nil {
if link, err = a.dp.GetFullLink("verify", token); err != nil {
a.logger.Warn("Failed to generate verification link", zap.Error(err), zap.String("login", account.Login))
return err
}

View File

@@ -188,10 +188,9 @@ func TestOnAccount_ValidAccount_SendsWelcomeEmail(t *testing.T) {
Locale: "en-US",
},
},
VerifyToken: "test-verify-token",
}
err := api.onAccount(context.Background(), account)
err := api.onAccount(context.Background(), account, "test-verify-token")
if err != nil {
t.Fatalf("Unexpected error: %v", err)
@@ -242,10 +241,9 @@ func TestOnAccount_LinkGenerationFails_ReturnsError(t *testing.T) {
Locale: "en-US",
},
},
VerifyToken: "test-verify-token",
}
err := api.onAccount(context.Background(), account)
err := api.onAccount(context.Background(), account, "test-verify-token")
if err == nil {
t.Fatal("Expected error from link generation failure")
@@ -285,10 +283,9 @@ func TestOnAccount_SendFails_ReturnsError(t *testing.T) {
Locale: "en-US",
},
},
VerifyToken: "test-verify-token",
}
err := api.onAccount(context.Background(), account)
err := api.onAccount(context.Background(), account, "test-verify-token")
if err == nil {
t.Fatal("Expected error from send failure")