Commit 3a79c635 authored by Eric's avatar Eric

Fix MFA login http response error

parent 334fc5b1
......@@ -95,7 +95,7 @@ func CheckMFA(ctx ssh.Context, challenger gossh.KeyboardInteractiveChallenge) (r
logger.Error("Mfa Auth failed, may be user password or publickey auth failed")
return
}
resp, err := service.CheckUserOTP(seed, mfaCode)
resp, err := service.CheckUserOTP(seed, mfaCode, remoteAddr, "T")
if err != nil {
logger.Error("Mfa Auth failed: ", err)
return
......
......@@ -56,10 +56,12 @@ func GetUserByUsername(username string) (user *model.User, err error) {
return
}
func CheckUserOTP(seed, code string) (resp *AuthResp, err error) {
func CheckUserOTP(seed, code, remoteAddr, loginType string) (resp *AuthResp, err error) {
data := map[string]string{
"seed": seed,
"otp_code": code,
"seed": seed,
"otp_code": code,
"remote_addr": remoteAddr,
"login_type": loginType,
}
_, err = client.Post(UserAuthOTPURL, data, &resp)
if err != nil {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment