Removed dead code
This commit is contained in:
parent
f58a4dc05f
commit
2eb090d16c
@ -24,9 +24,6 @@ from kspace import views
|
||||
urlpatterns = [
|
||||
url(r'^$', views.index),
|
||||
url(r'^admin/', admin.site.urls),
|
||||
#url(r'^login/', views.login_view),
|
||||
#url(r'^logout/', views.logout_view),
|
||||
#url(r'^register/', views.register),
|
||||
url(r'^challenge/(?P<id>[0-9]+)', views.challenge),
|
||||
url(r'^challenges/', views.challenges),
|
||||
url(r'^halloffame/', views.hall_of_fame),
|
||||
|
@ -14,55 +14,6 @@ def index(request):
|
||||
return render(request, 'index.html', data)
|
||||
|
||||
|
||||
@csrf_protect
|
||||
def register(request):
|
||||
if request.method == 'GET':
|
||||
return render(request, 'register.html')
|
||||
elif request.method == 'POST':
|
||||
username = request.POST['user']
|
||||
password = request.POST['pw']
|
||||
password_confirmation = request.POST['password_confirmation']
|
||||
|
||||
if len(password) < 8:
|
||||
return HttpResponse("password too short")
|
||||
|
||||
if password != password_confirmation:
|
||||
return HttpResponse("passwords do not match")
|
||||
|
||||
if not User.objects.filter(username=username).exists():
|
||||
user = User.objects.create_user(username, password=password)
|
||||
user.save()
|
||||
else:
|
||||
return HttpResponse("user exist")
|
||||
|
||||
return HttpResponse("User {} created".format(username))
|
||||
|
||||
|
||||
@csrf_protect
|
||||
def login_view(request):
|
||||
if request.method == 'GET':
|
||||
auth_user = 'no user'
|
||||
if request.user.is_authenticated:
|
||||
auth_user = request.user.username
|
||||
return render(request, 'login.html', {'auth_user': auth_user})
|
||||
elif request.method == 'POST':
|
||||
username = request.POST['user']
|
||||
password = request.POST['pw']
|
||||
|
||||
user = authenticate(username=username, password=password)
|
||||
|
||||
if user is not None:
|
||||
login(request, user)
|
||||
return HttpResponse('request suq')
|
||||
else:
|
||||
return HttpResponse('invalid username or password')
|
||||
|
||||
|
||||
def logout_view(request):
|
||||
logout(request)
|
||||
return HttpResponse('logged out')
|
||||
|
||||
|
||||
def challenge(request, id):
|
||||
if request.method == 'GET':
|
||||
data = {
|
||||
|
Reference in New Issue
Block a user