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="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 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>
|
<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>
|
</ul>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
|
@ -17,6 +17,7 @@ urlpatterns = [
|
|||||||
path('create_user', views.create_user, name='create_user'),
|
path('create_user', views.create_user, name='create_user'),
|
||||||
path('login', views.login, name='login'),
|
path('login', views.login, name='login'),
|
||||||
path('delete_user', views.delete_user, name='delete_user'),
|
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'),
|
path('<int:user_id>/delete_user', views.delete_user, name='delete_user'),
|
||||||
|
|
||||||
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)
|
||||||
|
@ -232,7 +232,6 @@ def login(request):
|
|||||||
return render(request , 'homepage/login.html')
|
return render(request , 'homepage/login.html')
|
||||||
|
|
||||||
def logout_user(request):
|
def logout_user(request):
|
||||||
if request.method == 'POST':
|
|
||||||
auth.logout(request)
|
auth.logout(request)
|
||||||
messages.success(request, 'Zostałeś wylogowany!')
|
messages.success(request, 'Zostałeś wylogowany!')
|
||||||
return render(request, index)
|
return redirect( index)
|
||||||
|
Loading…
Reference in New Issue
Block a user