def user_signin(request): if (request.method=='POST'): # perform signin user_email = request.POST['user_email'] password = request.POST['password'] user = Admin.user_signin(user_email, password, 'bookmark_django') if (not user): return HttpResponseRedirect('/bookmark/signin/') else: # write session variable request.session['user'] = user return HttpResponseRedirect('/bookmark/') else: # display signin context = Context({ 'signin':'Bookmark Manager' }) return render_to_response('bookmark/signin.djhtml', context, context_instance=RequestContext(request))
def user_signup(request): if (request.method=='POST'): user_email = request.POST['user_email'] password = request.POST['password'] password2 = request.POST['password_again'] if (password!=password2): return HttpResponseRedirect('/bookmark/signup/') user = Admin.user_signup(user_email, password, 'bookmark_django') if (user==None): return HttpResponseRedirect('/bookmark/signup/') # changed session to loggedin print ("about to set session") request.session['user']=user print ("set session") return HttpResponseRedirect('/bookmark/') else: context = Context({ 'signup':'Bookmark Manager' }) return render_to_response('bookmark/signup.djhtml', context, context_instance=RequestContext(request))