Merge pull request #8208 from DDDHuang/changepwd400
fix: user change pwd failed, response 400
This commit is contained in:
commit
c4be262819
|
@ -154,12 +154,10 @@ schema("/users/:username/change_pwd") ->
|
||||||
'requestBody' => fields([old_pwd, new_pwd]),
|
'requestBody' => fields([old_pwd, new_pwd]),
|
||||||
responses => #{
|
responses => #{
|
||||||
204 => <<"Update user password successfully">>,
|
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),
|
404 => response_schema(404),
|
||||||
400 => emqx_dashboard_swagger:error_codes(
|
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">>};
|
{404, ?USER_NOT_FOUND, <<"User not found">>};
|
||||||
{error, <<"password_error">>} ->
|
{error, <<"password_error">>} ->
|
||||||
?SLOG(error, LogMeta#{result => failed, reason => "error old pwd"}),
|
?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} ->
|
{error, Reason} ->
|
||||||
?SLOG(error, LogMeta#{result => failed, reason => Reason}),
|
?SLOG(error, LogMeta#{result => failed, reason => Reason}),
|
||||||
{400, ?BAD_REQUEST, Reason}
|
{400, ?BAD_REQUEST, Reason}
|
||||||
|
|
Loading…
Reference in New Issue