
from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.http import HttpResponseRedirect


def login_demo_account(request):
    new_user = authenticate(username='gmcdev',
            password='g3n3d3z')
    login(request, new_user)
    return HttpResponseRedirect("/")


from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.http import HttpResponseRedirect


def login_demo_account(request):
    new_user = authenticate(username='gmcdev',
            password='g3n3d3z')
    login(request, new_user)
    redirect_url = request.GET.get('next', '/')
    return HttpResponseRedirect(redirect_url)

Handle redirect_url in demo login bypass.
Handle redirect_url in demo login bypass.

  
  from django.contrib.auth import authenticate
  from django.contrib.auth import login
  from django.http import HttpResponseRedirect
  
  
  def login_demo_account(request):
      new_user = authenticate(username='gmcdev',
              password='g3n3d3z')
      login(request, new_user)
+     redirect_url = request.GET.get('next', '/')
-     return HttpResponseRedirect("/")
+     return HttpResponseRedirect(redirect_url)
  
Handle redirect_url in demo login bypass.
## Code Before:

from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.http import HttpResponseRedirect


def login_demo_account(request):
    new_user = authenticate(username='gmcdev',
            password='g3n3d3z')
    login(request, new_user)
    return HttpResponseRedirect("/")

## Instruction:
Handle redirect_url in demo login bypass.
## Code After:

from django.contrib.auth import authenticate
from django.contrib.auth import login
from django.http import HttpResponseRedirect


def login_demo_account(request):
    new_user = authenticate(username='gmcdev',
            password='g3n3d3z')
    login(request, new_user)
    redirect_url = request.GET.get('next', '/')
    return HttpResponseRedirect(redirect_url)
