log in log out
This commit is contained in:
parent
bcf438dbc0
commit
468d6da4d6
BIN
SocialHelper/SocialHelper/static/login.png
Normal file
BIN
SocialHelper/SocialHelper/static/login.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.5 KiB |
BIN
SocialHelper/SocialHelper/static/logout.png
Normal file
BIN
SocialHelper/SocialHelper/static/logout.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 2.4 KiB |
Binary file not shown.
Binary file not shown.
@ -25,6 +25,11 @@
|
||||
<li class="search_icon"><a href="#"><i class="icon-magnifier icons"></i></a></li>
|
||||
<li class="user_icon"><a href="/homepage/my_offer"><i class="icon-user icons"></i></a></li>
|
||||
<li ><a href="/homepage/add_offer"><img src="{% static "plus.png"%}" height="20"/></a></li>
|
||||
{% if user.email %}
|
||||
<li> <a href="logout_user"><img src="{% static "logout.png"%}" height="25"/></a></li>
|
||||
{% else %}
|
||||
<li> <a href="login"><img src="{% static "login.png"%}" height="25"/></a></li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
</nav>
|
||||
</div>
|
||||
|
@ -17,6 +17,7 @@ urlpatterns = [
|
||||
path('create_user', views.create_user, name='create_user'),
|
||||
path('login', views.login, name='login'),
|
||||
path('delete_user', views.delete_user, name='delete_user'),
|
||||
path('logout_user', views.logout_user, name='logout_user'),
|
||||
path('<int:user_id>/delete_user', views.delete_user, name='delete_user'),
|
||||
|
||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||
|
@ -231,8 +231,7 @@ def login(request):
|
||||
return redirect(login)
|
||||
return render(request , 'homepage/login.html')
|
||||
|
||||
def logout_user(request):
|
||||
if request.method == 'POST':
|
||||
auth.logout(request)
|
||||
messages.success(request, 'Zostałeś wylogowany!')
|
||||
return render(request, index)
|
||||
def logout_user(request):
|
||||
auth.logout(request)
|
||||
messages.success(request, 'Zostałeś wylogowany!')
|
||||
return redirect( index)
|
||||
|
Loading…
Reference in New Issue
Block a user