Doba pro neodhlašování přesunuta do settings
This commit is contained in:
		
							parent
							
								
									e643174f5f
								
							
						
					
					
						commit
						4dfe3bef7b
					
				
					 2 changed files with 3 additions and 1 deletions
				
			
		|  | @ -52,6 +52,7 @@ LOGIN_REDIRECT_URL = 'profil' | |||
| # (pozor nefunguje na firefox se znovuotevíráním oken po startu firefoxu) | ||||
| # default je False a SESSION_COOKIE_AGE = 3600*24*14 = 2 týdny | ||||
| SESSION_EXPIRE_AT_BROWSER_CLOSE = True | ||||
| DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT = 365 * 24 * 3600  # rok | ||||
| 
 | ||||
| # Modules configuration | ||||
| 
 | ||||
|  |  | |||
|  | @ -1,3 +1,4 @@ | |||
| from django.conf import settings | ||||
| from django.http import HttpResponseRedirect | ||||
| from django.urls import reverse_lazy | ||||
| from django.contrib.auth import views as auth_views | ||||
|  | @ -16,7 +17,7 @@ class LoginView(auth_views.LoginView): | |||
| 		""" Okopírováno z django/contrib/auth/views.py s přidáním nekonečného přihlášení """ | ||||
| 		auth_login(self.request, form.get_user()) | ||||
| 		if form.cleaned_data["disable_logout"]: | ||||
| 			form.request.session.set_expiry(365 * 24 * 3600)  # rok | ||||
| 			form.request.session.set_expiry(settings.DOBA_ODHLASENI_PRI_ZASKRTNUTI_NEODHLASOVAT) | ||||
| 		return HttpResponseRedirect(self.get_success_url()) | ||||
| 
 | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
		Reference in a new issue