Example #1
0
async def register(request):
    data = await request.json()

    username, password = data['username'], data['password']

    if UserService.get_user(username=username):
        return utils.json_response({
            "errors": [
                {"username": "******"}
            ]
        })

    user = UserService.add_user(username, password)

    return web.Response(text=utils.create_jwt_token(user.id))
Example #2
0
def add_user():
    return json.dumps(userService.add_user(request.json))