fix(dashboard): create user return 405

This commit is contained in:
zhongwencool 2021-09-23 11:25:02 +08:00
parent a99e54a6a2
commit 29b96bae2e
1 changed files with 14 additions and 3 deletions

View File

@ -100,6 +100,15 @@ schema("/users") ->
200 => mk(array(ref(?MODULE, user)),
#{desc => "User lists"})
}
},
post => #{
tags => [<<"dashboard">>],
description => <<"Create dashboard users">>,
requestBody => fields(user_password),
responses => #{
200 => <<"Create user successfully">>,
400 => [{code, mk(string(), #{example => 'CREATE_FAIL'})},
{message, mk(string(), #{example => "Create user failed"})}]}
}
};
@ -149,12 +158,14 @@ schema("/users/:username/change_pwd") ->
fields(user) ->
[
{tag,
mk(string(),
mk(binary(),
#{desc => <<"tag">>, example => "administrator"})},
{username,
mk(string(),
mk(binary(),
#{desc => <<"username">>, example => "emqx"})}
].
];
fields(user_password) ->
fields(user) ++ [{password, mk(binary(), #{desc => "Password"})}].
login(post, #{body := Params}) ->
Username = maps:get(<<"username">>, Params),