LIL-133, LIL-134 User menu & Logout

remotes/origin/hasaccess
Ivlev Denis 8 years ago
parent f127693fd4
commit 0b962aa420
  1. 5
      apps/auth/views.py
  2. 25
      project/templates/lilcity/index.html

@ -11,6 +11,7 @@ from django.utils.decorators import method_decorator
from django.views.decorators.csrf import csrf_exempt
from django.views.generic import FormView, View
from django.views.generic.edit import BaseFormView
from django.shortcuts import redirect
from apps.notification.utils import send_email
from .forms import LearnerRegistrationForm
@ -56,9 +57,9 @@ class LearnerRegistrationView(FormView):
class LogoutView(View):
def post(self, request, *args, **kwargs):
def get(self, request, *args, **kwargs):
logout(request)
return JsonResponse({"success": True})
return redirect('/')
class LoginView(FormView):

@ -122,11 +122,36 @@
<div class="header__group"><a class="header__section" href="#">БЛОГ</a></div>
</nav>
</div>
{% if user.is_authenticated %}
<div class="header__login">
{% if user.photo %}
<div class="header__ava ava"><img class="ava__pic" src="{{ user.photo.url }}"></div>
{% else %}
<div class="header__ava ava"><img class="ava__pic" src="img/user.jpg"></div>
{% endif %}
<div class="header__drop">
{% comment %} <a class="header__link header__link_border" href="#">234.120.345 руб.</a> {% endcomment %}
<a class="header__link header__link_green" href="#">
<div class="header__title">ДОБАВИТЬ КУРС</div>
</a>
<a class="header__link" href="#">
<div class="header__title">ПРОФИЛЬ</div>
</a>
<a class="header__link" href="#">
<div class="header__title">НАСТРОЙКИ</div>
</a>
<a class="header__link" href="{% url 'lilcity:logout' %}">
<div class="header__title">ВЫЙТИ</div>
</a>
</div>
</div>
{% else %}
<button class="header__enter js-header-enter" data-popup=".js-popup-auth">ВХОД
<svg class="icon icon-user">
<use xlink:href={% static "img/sprite.svg" %}#icon-user></use>
</svg>
</button>
{% endif %}
</div>
</div>
</header>

Loading…
Cancel
Save