Beispiel #1
0
def client():
    if request.method == "GET":
        clients = Client.get_all(g.start, g.limit)
        return render_template("client.html", clients=clients)

    redirect_uri = request.form.get("redirect_uri", default="")
    name = request.form.get("name", default="")
    if not (redirect_uri and name):
        flash(u"缺少需要填写的", "error")
        return redirect(url_for("oauth.client"))

    Client.create(name, [redirect_uri], ["email"])
    return redirect(url_for("oauth.client"))
Beispiel #2
0
def client():
    if request.method == 'GET':
        clients = Client.get_all(g.start, g.limit)
        return render_template('client.html', clients=clients)

    redirect_uri = request.form.get('redirect_uri', default='')
    name = request.form.get('name', default='')
    if not (redirect_uri and name):
        flash(u'缺少需要填写的', 'error')
        return redirect(url_for('oauth.client'))

    Client.create(name, [redirect_uri], ['email'])
    return redirect(url_for('oauth.client'))
Beispiel #3
0
def authorize(*args, **kwargs):
    if request.method == 'GET':
        client_id = kwargs.get('client_id')
        client = Client.get_by_client_id(client_id)
        kwargs['client'] = client
        kwargs['user'] = g.user
        return render_template('authorize.html', **kwargs)

    return request.form.get('agree', type=bool, default=False)
Beispiel #4
0
def authorize(*args, **kwargs):
    if request.method == "GET":
        client_id = kwargs.get("client_id")
        client = Client.get_by_client_id(client_id)
        kwargs["client"] = client
        kwargs["user"] = g.user
        return render_template("authorize.html", **kwargs)

    return request.form.get("agree", type=bool, default=False)
Beispiel #5
0
def load_client(client_id):
    return Client.get_by_client_id(client_id)
Beispiel #6
0
def delete_client():
    client_id = request.form['client']
    client = Client.get(client_id)
    client.delete()
    return jsonify({'message': 'ok'})
Beispiel #7
0
def delete_client():
    client_id = request.form["client"]
    client = Client.get(client_id)
    client.delete()
    return {"message": "ok"}