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"))
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'))
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)
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)
def load_client(client_id): return Client.get_by_client_id(client_id)
def delete_client(): client_id = request.form['client'] client = Client.get(client_id) client.delete() return jsonify({'message': 'ok'})
def delete_client(): client_id = request.form["client"] client = Client.get(client_id) client.delete() return {"message": "ok"}