From 468d6da4d6ece19e22842a903d3bf49370b19ec8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C4=99drzej=20Klepacki?= Date: Sun, 20 Dec 2020 23:30:16 +0100 Subject: [PATCH] log in log out --- SocialHelper/SocialHelper/static/login.png | Bin 0 -> 2557 bytes SocialHelper/SocialHelper/static/logout.png | Bin 0 -> 2407 bytes .../homepage/__pycache__/urls.cpython-37.pyc | Bin 860 -> 894 bytes .../homepage/__pycache__/views.cpython-37.pyc | Bin 5815 -> 5791 bytes SocialHelper/homepage/templates/navbar.html | 5 +++++ SocialHelper/homepage/urls.py | 1 + SocialHelper/homepage/views.py | 9 ++++----- 7 files changed, 10 insertions(+), 5 deletions(-) create mode 100644 SocialHelper/SocialHelper/static/login.png create mode 100644 SocialHelper/SocialHelper/static/logout.png diff --git a/SocialHelper/SocialHelper/static/login.png b/SocialHelper/SocialHelper/static/login.png new file mode 100644 index 0000000000000000000000000000000000000000..2eb85f8434cf271830f87cee7d4ba6e7076ab057 GIT binary patch literal 2557 zcmV^NiKow4scX5nXpQ#8;k*DlgeC2J3=3|5A$I z3v;SE5P*xgRZ&EQs)%oEeYNuc|J{Yt_SPm?$R=4x>o;>|&N<@*zGBI1v-|LX#*d?U zXZJjtwNsXZj79&7VY8TFzktDyj0Vp!Uf^e<-7?ua;}q`-`-*S>xJl8cyaMb^f2TvT zJDYB82do+ZcI&c^6#GT(Byek?_m9+Z`l|Fft|oy~wH1TA4?F4v2b;S2rGV92EAsQ3 zL4CfT*FdYSL~uTJt5&%McmoxJ7rSbapBPCC#$j!rU-aR8UM`J87=|BH+E0q6wjZVIE1IqqD;a#tptP*bLX*c@)KQ z>|=j$rSWs<4)^>lz;5C$usd;vZnDzuRe--faf)!pwKe13Gxk*V%o;-{;XCOrs-+P- zAVbtI z5N9}6wLB>gXV}NIGJi41aENJTK4At&V~M%6Vssg<6yGNvU53b6msE+Lyckg>DL>w>%nz4ykJ@}%5aKlH0e(RgkFkZf#P7Ug(OK8|hf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t??GmTwL4q34 zd=MG%5J4`sd|7)#IIm;`AAEKSRX0Go^3Xh~w_?zj9)RplR5^$+I0pqItkq+EpQ1Na zGKB0-s46510s(46CWm?0BCC-o036jV9Qn%=O(jnOz)F;^Q16Btw@!`#j|;_9Re#k# zfk=5=ojC4!)KNc8^}Dmf(Hmc7|DwmUJ#ReLISr4yugj0rUzN}wjoRy7RHXMGg+KGP TWi^Sx00000NkvXXu0mjfi+u7n literal 0 HcmV?d00001 diff --git a/SocialHelper/SocialHelper/static/logout.png b/SocialHelper/SocialHelper/static/logout.png new file mode 100644 index 0000000000000000000000000000000000000000..9fc0c18259de37700d00de4b61e116dd53456069 GIT binary patch literal 2407 zcmV-t37GbYP)xyyu=i>R> z(ERP_{`vOdMF;)#@Z(Y;WFIh(Z%kglJ?5H=yp`}!LsRpUFU8| z=4CzcuAB6}t>s`g^0J@rq>lXR;^%Qq>3m!E%)se+R^m($?Vpb2WkuSZwO{}M2#iTY zK~#90?VV|3+Bgt~jj97fSQ73~Si%(`kh1yze{RXqlt?BXkH$hnc|Ql+Pi$!<&6OlT zwV$f3@$+OdJ?OFdrhkt0BVYgIshOjC2l}){)fv}bluXl9evu%S%++dBErYMuY-nLr zB?1|tW@B=|@}Wh_*J{MX_a-fCgyV4|V&i+2Y}ASPIy)J~@N;Ck6B58) zL!2AsluWuN0BkSxxj{}#5g>L}5d$6&<)bg*NS+(wdl}_vHP-355%OgEJs-e373VB^ zEHU&UoJBndKa_fWr;}*y#Iej4Pq>P4DdS2!V*%^g(~MH)k2FNMZIpeL*V|=I3wnno z9A%6`Bctzh>_m9qD#xtA^3d$B%E{E;^g-w(~_}pJqIh5_dSjcGvxn ziN^G)SK1ysU!CzRV;3McxT~$*d4_byg4B56yhby}UFyO4XUQAdhsCKnupdlyQU7@N zBgKzsT2+PpWbz4f9fwevQVxI++SuaeD4xymfZjz{Dk3`wT zT*e{P=%oX><~AYfpYIaVp5OUsXAz2jF;|J1&|Ym(5mFuA`O6`!VXop5#$qg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$Sw2<-_o#FdKG9mohwhAQ9% zJf|+7kfw*FLl{w~)hi)PF%#1C1Ge+=uY@6W`GhpR)&D}mh`LsnMMxQsNL^m#t;$VEe)X^JFf}D;541+h9zYV8l>f_qhs4PMc=harYKcoIwTH9m$8sb*vGb`@+yENd>8{1=6qTfV zJ6<})88Ul$dsvyqG1uI>4~F}?>?1p({9 literal 0 HcmV?d00001 diff --git a/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc b/SocialHelper/homepage/__pycache__/urls.cpython-37.pyc index 169035a640dc2c08613016b174200a94e59e1cc0..49a7c78088860c6c58cbe09a37c046e06a46c429 100644 GIT binary patch delta 148 zcmcb^_K!`&iId8vVPJR+;=q6)kl_Ht#Y~J7HLmN6q==?)^fIS1rii7o zWC^E;fOzS=sT`?nS)xEJmLlHEB+d{eo+1&L?<6+(qfYZ8eAkh`7@I%qtawcWbxP%)sy%#DM_;Aj1KOi@z{T)VQuFoFbCK(aW69lgg3G zmL&qjqA6m%OyUetVkzRm44M*?^%&nz)?(6Q6rUW))G_%PlRBFWP$WX$xfVqYtg>fMhkj+xU q+RPZtpvmMnd4-4!2U`(8P;C+WWC0H-jAQOkvCPOUJJ;pVaQ@gVa#SKQYc|uz*NJqkdcw0gn0o= z4MPgkLM9-awT7XDt(hs9L6h09$ONdPR18Q&
  • + {% if user.email %} +
  • + {% else %} +
  • + {% endif %} diff --git a/SocialHelper/homepage/urls.py b/SocialHelper/homepage/urls.py index 024d2ad..08bc1ab 100644 --- a/SocialHelper/homepage/urls.py +++ b/SocialHelper/homepage/urls.py @@ -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('/delete_user', views.delete_user, name='delete_user'), ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/SocialHelper/homepage/views.py b/SocialHelper/homepage/views.py index 5e43edf..e2632ff 100644 --- a/SocialHelper/homepage/views.py +++ b/SocialHelper/homepage/views.py @@ -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)