Beispiel #1
0
def login(request):
	if not UserPro.objects.all():
		new_user_pro = UserPro(username="******")
		new_user_pro.save()
		new_other_profile = OtherProfile(username="******")
		new_other_profile.save()

	c = {}
	c.update(csrf(request))
	return render_to_response('twitterclone/login.html',c)
Beispiel #2
0
def auth_view(request):
	username = request.POST.get('username', '')
	password = request.POST.get('password', '')
	user = auth.authenticate(username=username,password=password)
	if user is not None:
		auth.login(request,user)
		user.save()
		has_profile=-5
		try:
			has_profile = UserPro.objects.get(username=username)
		except:	
			error=1
		if has_profile == -5:
			new_user_pro = UserPro(username=username)
			new_user_pro.save()
			new_other_profile = OtherProfile(username=username)
			new_other_profile.save()
		return HttpResponseRedirect('/home')
	else:
		return HttpResponseRedirect('/invalid')