示例#1
0
def login(request):
    if(membership.getUser(request)):
        return HttpResponseRedirect("/account/home/")
    email = "";
    error = ""
    if request.method == 'POST':
        email = request.POST['email']
        password = request.POST['password']
        user = getUsernameByCredentials(email, password)
        if user == None:
            error = "Wrong combination"
        else:
            membership.login(request, user)
            return HttpResponseRedirect("/account/home/")

    return render_to_response('account/login.html', {"email":email, "error":error},
        context_instance = RequestContext(request))
示例#2
0
def home(request):
    user = membership.getUser(request)
    if user == None:
        return HttpResponseRedirect("/account/login/")
    return render_to_response("account/home.html", {"user":user})