Ejemplo n.º 1
0
def login_view(request):
    username = request.POST['username']
    password = request.POST['password']
    user = authenticate(username=username, password=password)
    if user:
        login(request, user)
    else:
        return jsonerror()        
    author = Author.get_by_user(request.user)
    return jsonify(
        success=True, 
        navbar=srender('user/navbar.jinja', user=user),
        home=srender('user/home.jinja', author=author))
Ejemplo n.º 2
0
def login_view(request):
    username = request.POST['username']
    password = request.POST['password']
    user = authenticate(username=username, password=password)
    if user:
        login(request, user)
    else:
        return jsonerror()        
    author = Author.get_by_user(request.user)
    return jsonify(
        success=True, 
        navbar=srender('user/navbar.jinja', user=user),
        home=srender('user/home.jinja', author=author))
Ejemplo n.º 3
0
def logout_view(request):
    logout(request)

    return jsonify(
        success=True, 
        navbar=srender('user/navbar.jinja')
    )
Ejemplo n.º 4
0
def open_sharing_view(request):
    author = Author.get_by_user(request.user)
    padmember = author.get_padmember(request.POST["id"])
    if not padmember or not padmember.check_access("read"):
        return jsonify(success=False)

    return jsonify(success=True, sharing=srender("share/pad.jinja", members=padmember.pad.get_members_in_order()))
Ejemplo n.º 5
0
def open_sharing_view(request):
    'Returns the sharing html for a pad'
    author = Author.get_by_user(request.user)
    padmember = author.get_padmember(request.POST['id'])
    if not padmember or not padmember.check_access('read'):
        return jsonify(success=False)
    invites = padmember.pad.get_invites_in_order()

    return jsonify(success=True,
                   sharing=srender(
                       'share/pad.jinja',
                       members=padmember.pad.get_members_in_order(),
                       invites=invites))
Ejemplo n.º 6
0
def open_sharing_view(request):
    'Returns the sharing html for a pad'
    author = Author.get_by_user(request.user)
    padmember = author.get_padmember(request.POST['id'])
    if not padmember or not padmember.check_access('read'):
        return jsonify(success=False)
    invites = padmember.pad.get_invites_in_order()

    return jsonify(
        success=True,
        sharing=srender('share/pad.jinja', 
            members=padmember.pad.get_members_in_order(),
            invites=invites
        ))
Ejemplo n.º 7
0
def logout_view(request):
    logout(request)
    return jsonify(
        success=True, 
        navbar=srender('user/navbar.jinja')
    )