from django.shortcuts import render, redirect
from django.contrib.auth import views as auth_views

# Create your views here.
def index(request):
	pass

def login(request, **kwargs):
	if request.user.is_authenticated():
		return redirect('index')
	else:
		return auth_views.login(request)

from django.shortcuts import render, redirect
from django.contrib.auth import views as auth_views
from django.views.decorators.http import require_POST

# Create your views here.
def index(request):
	pass

@require_POST
def login(request, **kwargs):
	if request.user.is_authenticated():
		return redirect('index')
	else:
		return auth_views.login(request)

Modify login view to be a post endpoint
Modify login view to be a post endpoint

  from django.shortcuts import render, redirect
  from django.contrib.auth import views as auth_views
+ from django.views.decorators.http import require_POST
  
  # Create your views here.
  def index(request):
  	pass
  
+ @require_POST
  def login(request, **kwargs):
  	if request.user.is_authenticated():
  		return redirect('index')
  	else:
  		return auth_views.login(request)
  
Modify login view to be a post endpoint
## Code Before:
from django.shortcuts import render, redirect
from django.contrib.auth import views as auth_views

# Create your views here.
def index(request):
	pass

def login(request, **kwargs):
	if request.user.is_authenticated():
		return redirect('index')
	else:
		return auth_views.login(request)

## Instruction:
Modify login view to be a post endpoint
## Code After:
from django.shortcuts import render, redirect
from django.contrib.auth import views as auth_views
from django.views.decorators.http import require_POST

# Create your views here.
def index(request):
	pass

@require_POST
def login(request, **kwargs):
	if request.user.is_authenticated():
		return redirect('index')
	else:
		return auth_views.login(request)
