Merge pull request #8208 from DDDHuang/changepwd400

fix: user change pwd failed, response 400
This commit is contained in:
zhongwencool 2022-06-15 19:55:40 +08:00 committed by GitHub
commit c4be262819
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 5 deletions

View File

@ -154,12 +154,10 @@ schema("/users/:username/change_pwd") ->
'requestBody' => fields([old_pwd, new_pwd]),
responses => #{
204 => <<"Update user password successfully">>,
401 => emqx_dashboard_swagger:error_codes(
[?WRONG_USERNAME_OR_PWD, ?ERROR_PWD_NOT_MATCH], ?DESC(login_failed401)
),
404 => response_schema(404),
400 => emqx_dashboard_swagger:error_codes(
[?BAD_REQUEST], ?DESC(login_failed_response400)
[?BAD_REQUEST, ?ERROR_PWD_NOT_MATCH],
?DESC(login_failed_response400)
)
}
}
@ -308,7 +306,7 @@ change_pwd(put, #{bindings := #{username := Username}, body := Params}) ->
{404, ?USER_NOT_FOUND, <<"User not found">>};
{error, <<"password_error">>} ->
?SLOG(error, LogMeta#{result => failed, reason => "error old pwd"}),
{401, ?ERROR_PWD_NOT_MATCH, <<"Old password not match">>};
{400, ?ERROR_PWD_NOT_MATCH, <<"Old password not match">>};
{error, Reason} ->
?SLOG(error, LogMeta#{result => failed, reason => Reason}),
{400, ?BAD_REQUEST, Reason}