text: from django.contrib.auth import login, authenticate
  from django.shortcuts import render, redirect
  from django.contrib.auth.decorators import login_required
  from django.contrib.auth import logout
  from django.contrib import messages
  from django.contrib.auth import update_session_auth_hash
  from django.contrib.auth.forms import PasswordChangeForm
  from apps.user.forms import SignUpForm
  
  
  @login_required
  def home(request):
      return render(request, 'main/index.html')
  
  
  def signup(request):
      if request.method == 'POST':
          form = SignUpForm(request.POST)
          if form.is_valid():
              form.save()
              username = form.cleaned_data.get('username')
              raw_password = form.cleaned_data.get('password1')
              # user = authenticate(request, username=username, password=raw_password)
              user = form.save()
              login(request, user, backend='django.contrib.auth.backends.ModelBackend')
              return redirect('main')
      else:
          form = SignUpForm()
      return render(request, 'user/index.html', {'form': form})
  
  
  def change_password(request):
      if request.method == 'POST':
          form = PasswordChangeForm(request.user, request.POST)
          if form.is_valid():
              user = form.save()
              update_session_auth_hash(request, user)
              messages.success(request, 'Ваш пароль был успешно обновлён!')
              return redirect('password_change_done')
          else:
              messages.error(request, 'Пожалуйста, исправьте ошибку выше.')
      else:
          form = PasswordChangeForm(request.user)
      return render(request, 'user/change_password.html', {
          'form': form
      })
  