admin_api.users: allow PUT method to create user

PUT was the wanted method. POST serves as a fallback.

closes !56
This commit is contained in:
Luna 2020-02-03 06:40:16 -03:00
parent d2e219a1df
commit 9998092db4
1 changed files with 1 additions and 4 deletions

View File

@ -35,14 +35,11 @@ from litecord.common.users import (
bp = Blueprint("users_admin", __name__) bp = Blueprint("users_admin", __name__)
@bp.route("", methods=["POST"]) @bp.route("", methods=["POST", "PUT"])
async def _create_user(): async def _create_user():
await admin_check() await admin_check()
j = validate(await request.get_json(), USER_CREATE) j = validate(await request.get_json(), USER_CREATE)
user_id, _ = await create_user(j["username"], j["email"], j["password"]) user_id, _ = await create_user(j["username"], j["email"], j["password"])
return jsonify(await app.storage.get_user(user_id)) return jsonify(await app.storage.get_user(user_id))