fixed verification code
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
@@ -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")
|
||||
|
||||
Reference in New Issue
Block a user