Ejemplo n.º 1
0
def save_token(token, request):
    tokens.BearerToken.create(
        client=request.client,
        user=session.get_user(),
        access_token=token["access_token"],
        refresh_token=token.get("refresh_token"),
        expires_in=token["expires_in"],
        scopes=token["scope"].split(),
        token_type=token["token_type"]
    ).save()
Ejemplo n.º 2
0
def signup():
    user = session.get_user()
    username = request.values.get("username", user.username) or ""
    email = request.values.get("email", user.primary_email) or ""
    next = request.values.get("next")

    errors = []
    if request.method == "POST":
        errors = user.update_profile(email=email, username=username)
        if len(errors) == 0:
            user.is_new = False
            user.save()
            return redirect(next)

    return render_template("signup.html", email=email, username=username, next=next, errors=errors)
Ejemplo n.º 3
0
def signup():
    user = session.get_user()
    username = request.values.get("username", user.username) or ""
    email = request.values.get("email", user.primary_email) or ""
    next = request.values.get("next")

    errors = []
    if request.method == "POST":
        errors = user.update_profile(email=email, username=username)
        if len(errors) == 0:
            user.is_new = False
            user.save()
            return redirect(next)

    return render_template("signup.html",
                           email=email,
                           username=username,
                           next=next,
                           errors=errors)
Ejemplo n.º 4
0
def save_grant(client_id, code, request, *args, **kwargs):
    grant = tokens.GrantToken.create(client_id, code["code"], session.get_user(),
                                     request.redirect_uri, request.scopes)
    grant.save()
    return grant