From 2e4a011009d8fe1c2775956b167ae9a18060a2d9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=89mile=20R=C3=A9?= Date: Wed, 18 Feb 2026 18:28:31 +0400 Subject: [PATCH] Do not create password reset token when user logs with saml MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Émile Ré --- pkg/iam/auth_service.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pkg/iam/auth_service.go b/pkg/iam/auth_service.go index 3f46d94bc..728ad84aa 100644 --- a/pkg/iam/auth_service.go +++ b/pkg/iam/auth_service.go @@ -233,6 +233,15 @@ func (s *AuthService) ActivateAccount( return nil, nil, err } + count, err := s.AccountService.CountSAMLConfigurationsForEmail(ctx, identity.EmailAddress) + if err != nil { + return nil, nil, fmt.Errorf("cannot count SAML configurations: %w", err) + } + + if count > 0 { + return profile, nil, nil + } + if identity.HashedPassword == nil { token, err := statelesstoken.NewToken( s.tokenSecret,