mirror of
https://github.com/zitadel/zitadel.git
synced 2025-08-11 19:07:30 +00:00
feat(login): add OTP (email and sms) (#6353)
* feat: login with otp * fix(i18n): japanese translation * add missing files * fix provider change * add event types translations to en * add tests * resourceOwner * remove unused handler * fix: secret generators and add comments * add setup step * rename * linting * fix setup * improve otp handling * fix autocomplete * translations for login and notifications * translations for event types * changes from review * check selected mfa type
This commit is contained in:
@@ -49,6 +49,8 @@ type HumanView struct {
|
||||
Region string
|
||||
StreetAddress string
|
||||
OTPState MFAState
|
||||
OTPSMSAdded bool
|
||||
OTPEmailAdded bool
|
||||
U2FTokens []*WebAuthNView
|
||||
PasswordlessTokens []*WebAuthNView
|
||||
MFAMaxSetUp domain.MFALevel
|
||||
@@ -162,10 +164,17 @@ func (u *UserView) MFATypesSetupPossible(level domain.MFALevel, policy *domain.L
|
||||
}
|
||||
case domain.SecondFactorTypeU2F:
|
||||
types = append(types, domain.MFATypeU2F)
|
||||
case domain.SecondFactorTypeOTPSMS:
|
||||
if !u.OTPSMSAdded {
|
||||
types = append(types, domain.MFATypeOTPSMS)
|
||||
}
|
||||
case domain.SecondFactorTypeOTPEmail:
|
||||
if !u.OTPEmailAdded {
|
||||
types = append(types, domain.MFATypeOTPEmail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//PLANNED: add sms
|
||||
}
|
||||
return types
|
||||
}
|
||||
@@ -189,10 +198,17 @@ func (u *UserView) MFATypesAllowed(level domain.MFALevel, policy *domain.LoginPo
|
||||
if u.IsU2FReady() {
|
||||
types = append(types, domain.MFATypeU2F)
|
||||
}
|
||||
case domain.SecondFactorTypeOTPSMS:
|
||||
if u.OTPSMSAdded {
|
||||
types = append(types, domain.MFATypeOTPSMS)
|
||||
}
|
||||
case domain.SecondFactorTypeOTPEmail:
|
||||
if u.OTPEmailAdded {
|
||||
types = append(types, domain.MFATypeOTPEmail)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//PLANNED: add sms
|
||||
}
|
||||
return types, required
|
||||
}
|
||||
|
Reference in New Issue
Block a user