feat: improve determination about whether dest is mail or phone and mask props (#1814)

This commit is contained in:
Yaodong Yu 2023-05-07 21:19:51 +08:00 committed by GitHub
parent 9201992140
commit 50586a9716
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 2 deletions

View File

@ -186,5 +186,9 @@ func (c *ApiController) SetPreferredMfa() {
}
object.UpdateUser(userId, user, []string{"multi_factor_auths"}, user.IsAdminUser())
c.ResponseOk(user.MultiFactorAuths)
for i, mfaProp := range mfaProps {
mfaProps[i] = object.GetMaskedProps(mfaProp)
}
c.ResponseOk(mfaProps)
}

View File

@ -37,7 +37,7 @@ type SmsMfa struct {
func (mfa *SmsMfa) SetupVerify(ctx *context.Context, passCode string) error {
dest := ctx.Input.CruSession.Get(MfaSmsDestSession).(string)
countryCode := ctx.Input.CruSession.Get(MfaSmsCountryCodeSession).(string)
if countryCode != "" {
if !util.IsEmailValid(dest) {
dest, _ = util.GetE164Number(dest, countryCode)
}