Correcting response on invalid login attempt (#2216)
Verifying detailed message error from bad login in SSO Test
This commit is contained in:
committed by
GitHub
parent
ea0cac2a92
commit
16fd5470db
@@ -19,6 +19,7 @@ package restapi
|
||||
import (
|
||||
"context"
|
||||
"errors"
|
||||
"strings"
|
||||
|
||||
"github.com/go-openapi/swag"
|
||||
"github.com/minio/console/models"
|
||||
@@ -69,6 +70,7 @@ var (
|
||||
ErrDeletingEncryptionConfig = errors.New("error disabling tenant encryption")
|
||||
ErrEncryptionConfigNotFound = errors.New("encryption configuration not found")
|
||||
ErrPolicyNotFound = errors.New("policy does not exist")
|
||||
ErrLoginNotAllowed = errors.New("login not allowed")
|
||||
)
|
||||
|
||||
// ErrorWithContext :
|
||||
@@ -93,6 +95,10 @@ func ErrorWithContext(ctx context.Context, err ...interface{}) *models.Error {
|
||||
errorCode = 401
|
||||
errorMessage = ErrInvalidLogin.Error()
|
||||
}
|
||||
if strings.Contains(err1.Error(), ErrLoginNotAllowed.Error()) {
|
||||
errorCode = 400
|
||||
errorMessage = ErrLoginNotAllowed.Error()
|
||||
}
|
||||
// console invalid erasure coding value
|
||||
if errors.Is(err1, ErrInvalidErasureCodingValue) {
|
||||
errorCode = 400
|
||||
|
||||
Reference in New Issue
Block a user