示例#1
0
def get_post_users():
    if flask.request.method == 'GET':
        return toolkit.response('OK', 200)
    try:
        data = json.loads(flask.request.data)
        if Auth.signin(data):
            return toolkit.response('OK', 200)
        else:
            cfg = config.load()
            if not cfg.allow_signup:
                return toolkit.api_error('Signup is not allowed', 400)
            else:
                if Auth.signup(data):
                    return toolkit.response('User Created', 201)
                else:
                    return toolkit.response('User Not Created', 400)
    except json.JSONDecodeError:
        return toolkit.api_error('Error Decoding JSON', 400)