Ejemplo n.º 1
0
def login(request):
	if request.method == "GET":
		if request.session.get('token',False):
			token = request.session('token')
			name = r.get_value(token)
			return welcome2(request,name)
		else:
			request.session['token'] = str(random.random())
			dictionary = {}
			dictionary.update(csrf(request))
			return render(request,'form.html',dictionary)
	elif request.method == 'POST':
		token = request.session['token']
		name = request.POST['name']
		r.set_value(token,name)
		return welcome2(request, name)
Ejemplo n.º 2
0
def login(request):
    if request.method == "GET":
        if request.session.get("token", False):
            token = request.session["token"]
            name = r.get_value(token)
            return welcome2(request, name)
        else:
            request.session["token"] = str(random.random())
            dictionary = {}
            dictionary.update(csrf(request))
            return render(request, "form.html", dictionary)
    elif request.method == "POST":
        token = request.session["token"]
        name = request.POST["name"]
        r.set_value(token, name)
        return welcome2(request, name)
Ejemplo n.º 3
0
def login(request):
    if request.method == "GET":
        if request.session.get('token', False):
            token = request.session['token']
            name = r.get_value(token)
            return welcome2(request, name)

        else:
            request.session['token'] = str(random.random())
            dictionary = {}
            dictionary.update(csrf(request))
            return render(request, 'form.html', dictionary)
    
    elif request.method == "POST":
         token = request.session['token']
         name = request.POST['name']
         r.set_value(token, name)
         return welcome2(request, name)