mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-10 12:50:29 +08:00
feat: improve determination about whether dest is mail or phone and mask props (#1814)
This commit is contained in:
@@ -186,5 +186,9 @@ func (c *ApiController) SetPreferredMfa() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
object.UpdateUser(userId, user, []string{"multi_factor_auths"}, user.IsAdminUser())
|
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)
|
||||||
}
|
}
|
||||||
|
@@ -37,7 +37,7 @@ type SmsMfa struct {
|
|||||||
func (mfa *SmsMfa) SetupVerify(ctx *context.Context, passCode string) error {
|
func (mfa *SmsMfa) SetupVerify(ctx *context.Context, passCode string) error {
|
||||||
dest := ctx.Input.CruSession.Get(MfaSmsDestSession).(string)
|
dest := ctx.Input.CruSession.Get(MfaSmsDestSession).(string)
|
||||||
countryCode := ctx.Input.CruSession.Get(MfaSmsCountryCodeSession).(string)
|
countryCode := ctx.Input.CruSession.Get(MfaSmsCountryCodeSession).(string)
|
||||||
if countryCode != "" {
|
if !util.IsEmailValid(dest) {
|
||||||
dest, _ = util.GetE164Number(dest, countryCode)
|
dest, _ = util.GetE164Number(dest, countryCode)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user