Auth: Fix email verification bypass when using basic authentication (#82914)
This commit is contained in:
@@ -2,13 +2,17 @@ package notifications
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/grafana/grafana/pkg/services/user"
|
||||
)
|
||||
|
||||
type NotificationServiceMock struct {
|
||||
Webhook SendWebhookSync
|
||||
EmailSync SendEmailCommandSync
|
||||
Email SendEmailCommand
|
||||
ShouldError error
|
||||
Webhook SendWebhookSync
|
||||
EmailSync SendEmailCommandSync
|
||||
Email SendEmailCommand
|
||||
EmailVerified bool
|
||||
EmailVerification SendVerifyEmailCommand
|
||||
ShouldError error
|
||||
|
||||
WebhookHandler func(context.Context, *SendWebhookSync) error
|
||||
EmailHandlerSync func(context.Context, *SendEmailCommandSync) error
|
||||
@@ -39,4 +43,20 @@ func (ns *NotificationServiceMock) SendEmailCommandHandler(ctx context.Context,
|
||||
return ns.ShouldError
|
||||
}
|
||||
|
||||
func (ns *NotificationServiceMock) SendResetPasswordEmail(ctx context.Context, cmd *SendResetPasswordEmailCommand) error {
|
||||
// TODO: Implement if needed
|
||||
return ns.ShouldError
|
||||
}
|
||||
|
||||
func (ns *NotificationServiceMock) ValidateResetPasswordCode(ctx context.Context, query *ValidateResetPasswordCodeQuery, userByLogin GetUserByLoginFunc) (*user.User, error) {
|
||||
// TODO: Implement if needed
|
||||
return nil, ns.ShouldError
|
||||
}
|
||||
|
||||
func (ns *NotificationServiceMock) SendVerificationEmail(ctx context.Context, cmd *SendVerifyEmailCommand) error {
|
||||
ns.EmailVerified = true
|
||||
ns.EmailVerification = *cmd
|
||||
return ns.ShouldError
|
||||
}
|
||||
|
||||
func MockNotificationService() *NotificationServiceMock { return &NotificationServiceMock{} }
|
||||
|
||||
Reference in New Issue
Block a user