fix: keystone username duplicate error should return 409

This commit is contained in:
Qiu Jian
2020-04-10 15:51:24 +08:00
parent 4c85b2e77e
commit 2eb748fb02
+3 -1
View File
@@ -85,7 +85,9 @@ func authenticateTokensV3(ctx context.Context, w http.ResponseWriter, r *http.Re
token, err := AuthenticateV3(ctx, input)
if err != nil {
switch errors.Cause(err) {
case sqlchemy.ErrDuplicateEntry, httperrors.ErrTooManyAttempts:
case sqlchemy.ErrDuplicateEntry:
httperrors.ConflictError(w, "duplicate username")
case httperrors.ErrTooManyAttempts:
httperrors.GeneralServerError(w, err)
default:
httperrors.UnauthorizedError(w, "unauthorized %s", err)