mirror of
https://github.com/zitadel/zitadel.git
synced 2025-01-06 13:27:45 +00:00
fix: use email as account name in otp instead of userid (#274)
* fix: use email as account name in otp instead of userid * fix: use email as account name in otp instead of userid
This commit is contained in:
parent
785c8d9763
commit
ee73dc07dd
@ -936,7 +936,11 @@ func (es *UserEventstore) AddOTP(ctx context.Context, userID string) (*usr_model
|
||||
if existing.IsOTPReady() {
|
||||
return nil, caos_errs.ThrowAlreadyExists(nil, "EVENT-do9se", "Errors.User.Mfa.Otp.AlreadyReady")
|
||||
}
|
||||
key, err := totp.Generate(totp.GenerateOpts{Issuer: es.Multifactors.OTP.Issuer, AccountName: userID})
|
||||
accountName := existing.UserName
|
||||
if existing.Email != nil {
|
||||
accountName = existing.EmailAddress
|
||||
}
|
||||
key, err := totp.Generate(totp.GenerateOpts{Issuer: es.Multifactors.OTP.Issuer, AccountName: accountName})
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user