fix: output error info

This commit is contained in:
Derrick Hammer 2023-06-07 13:12:37 -04:00
parent 2f7c31d53c
commit cfa7ceb2f4
Signed by: pcfreak30
GPG Key ID: C997C339BE476FF2
1 changed files with 3 additions and 3 deletions

View File

@ -219,7 +219,7 @@ func (a *AuthController) PostPubkeyLogin() {
verifiedToken, err := jwt.Verify(jwt.HS256, sharedKey, []byte(r.Challenge), blocklist) verifiedToken, err := jwt.Verify(jwt.HS256, sharedKey, []byte(r.Challenge), blocklist)
if err != nil { if err != nil {
msg := "invalid key challenge" msg := fmt.Sprintf("invalid key challenge: %s", err.Error())
logger.Get().Debug(msg, zap.Error(err), zap.String("challenge", r.Challenge)) logger.Get().Debug(msg, zap.Error(err), zap.String("challenge", r.Challenge))
a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg)) a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg))
return return
@ -227,7 +227,7 @@ func (a *AuthController) PostPubkeyLogin() {
rawPubKey, err := hex.DecodeString(r.Pubkey) rawPubKey, err := hex.DecodeString(r.Pubkey)
if err != nil { if err != nil {
msg := "invalid pubkey" msg := fmt.Sprintf("invalid pubkey: %s", err.Error())
logger.Get().Debug(msg, zap.Error(err), zap.String("pubkey", r.Pubkey)) logger.Get().Debug(msg, zap.Error(err), zap.String("pubkey", r.Pubkey))
a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg)) a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg))
return return
@ -235,7 +235,7 @@ func (a *AuthController) PostPubkeyLogin() {
rawSignature, err := hex.DecodeString(r.Signature) rawSignature, err := hex.DecodeString(r.Signature)
if err != nil { if err != nil {
msg := "invalid signature" msg := fmt.Sprintf("invalid signature: %s", err.Error())
logger.Get().Debug(msg, zap.Error(err), zap.String("signature", r.Signature)) logger.Get().Debug(msg, zap.Error(err), zap.String("signature", r.Signature))
a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg)) a.Ctx.StopWithError(iris.StatusBadRequest, errorx.RejectedOperation.New(msg))
return return