Exemple #1
0
def developer_register(request):
    """
    Gives user a way to create app that access other user's
    protected resource using OAuth.
    """
    form = ConsumerAppForm()
    return render_to_response("core/developer/register.html", {"form": form.as_widget()})
Exemple #2
0
def developer_do_register(request):
    """
    Process the app registration form.
    """
    form = ConsumerAppForm()
    if form.validate(request.form):
        token = OAuthDataStore.generate_tokens()
        consumer = form.save(user=request.user, consumer_key=token.key, consumer_secret=token.secret)
        return redirect(url_for("core/developer/app", app_id=consumer.key().id()))

    return render_to_response("core/developer/register.html", {"form": form.as_widget()})