Přihlašovací a odhlašovací a heslo-zapomínací views
Templates většinou chybí.
This commit is contained in:
		
							parent
							
								
									1004e785de
								
							
						
					
					
						commit
						4f1828b7af
					
				
					 4 changed files with 56 additions and 3 deletions
				
			
		|  | @ -13,6 +13,8 @@ | ||||||
|   <ul class="form"> |   <ul class="form"> | ||||||
|     {{ form.as_ul }} |     {{ form.as_ul }} | ||||||
| </ul> | </ul> | ||||||
|  | 	{# Django si posílá jméno další stránky jako obsah formuláře a výchozí hodnota (mi přišlo, že) nejde změnit... #} | ||||||
|  | 	<input type="hidden" name='next' value="{{ next }}"> | ||||||
|     <input type="submit" value="Přihlásit"> |     <input type="submit" value="Přihlásit"> | ||||||
| </form> | </form> | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
							
								
								
									
										18
									
								
								seminar/templates/seminar/logout.html
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										18
									
								
								seminar/templates/seminar/logout.html
									
									
									
									
									
										Normal file
									
								
							|  | @ -0,0 +1,18 @@ | ||||||
|  | {% extends "seminar/zadani/base.html" %} | ||||||
|  | {% load staticfiles %} | ||||||
|  | 
 | ||||||
|  | 
 | ||||||
|  | {% block content %} | ||||||
|  | <h1> | ||||||
|  |   {% block nadpis1a %}{% block nadpis1b %} | ||||||
|  |     Odhlášení | ||||||
|  |   {% endblock %}{% endblock %} | ||||||
|  | </h1> | ||||||
|  | 
 | ||||||
|  | Byl jsi úspěšně odhlášen | ||||||
|  | {# Tohle by se asi mělo udělat přes kontext (title), ale kašlu na to, stejně je to jen jednojazyčná stránka #} | ||||||
|  | 
 | ||||||
|  | {# TODO: odkaz na znovupřihlášení? #} | ||||||
|  | 
 | ||||||
|  | {% endblock %} | ||||||
|  | 
 | ||||||
|  | @ -103,10 +103,14 @@ urlpatterns = [ | ||||||
| 	), | 	), | ||||||
| 	path('auth/prihlaska/',views.prihlaskaView, name='seminar_prihlaska'), | 	path('auth/prihlaska/',views.prihlaskaView, name='seminar_prihlaska'), | ||||||
| 	path('auth/login/', views.LoginView.as_view(), name='login'), | 	path('auth/login/', views.LoginView.as_view(), name='login'), | ||||||
| 	path('auth/logout/', views.logoutView, name='logout'), | 	path('auth/logout/', views.LogoutView.as_view(), name='logout'), | ||||||
| 	path('auth/resitel/', views.ResitelView.as_view(), name='seminar_resitel'), | 	path('auth/resitel/', views.ResitelView.as_view(), name='seminar_resitel'), | ||||||
| 	path('autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'), | 	path('autocomplete/skola/',views.SkolaAutocomplete.as_view(), name='autocomplete_skola'), | ||||||
| 	path('auth/reset_password', views.resetPasswordView, name='reset_password'), | 	path('auth/reset_password/', views.PasswordResetView.as_view(), name='reset_password'), | ||||||
|  | 	path('auth/change_password/', views.PasswordChangeView.as_view(), name='change_password'), | ||||||
|  | 	path('auth/reset_password_done/', views.PasswordResetDoneView.as_view(), name='reset_password_done'), | ||||||
|  | 	path('auth/reset_password_confirm/', views.PasswordResetConfirmView.as_view(), name='reset_password_confirm'), | ||||||
|  | 	path('auth/reset_password_complete/', views.PasswordResetCompleteView.as_view(), name='reset_password_complete'), | ||||||
| 	path('auth/resitel_edit', views.resitelEditView, name='seminar_resitel_edit'), | 	path('auth/resitel_edit', views.resitelEditView, name='seminar_resitel_edit'), | ||||||
| 	path('', views.TitulniStranaView.as_view(), name='titulni_strana'), | 	path('', views.TitulniStranaView.as_view(), name='titulni_strana'), | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -2,7 +2,7 @@ | ||||||
| 
 | 
 | ||||||
| from django.shortcuts import get_object_or_404, render | from django.shortcuts import get_object_or_404, render | ||||||
| from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse | from django.http import HttpResponse, HttpResponseRedirect, HttpResponseForbidden, JsonResponse | ||||||
| from django.urls import reverse | from django.urls import reverse,reverse_lazy | ||||||
| from django.core.exceptions import PermissionDenied, ObjectDoesNotExist | from django.core.exceptions import PermissionDenied, ObjectDoesNotExist | ||||||
| from django.views import generic | from django.views import generic | ||||||
| from django.utils.translation import ugettext as _ | from django.utils.translation import ugettext as _ | ||||||
|  | @ -1281,3 +1281,32 @@ class LoginView(auth_views.LoginView): | ||||||
| 		ctx = super().get_context_data(**kwargs) | 		ctx = super().get_context_data(**kwargs) | ||||||
| 		ctx['next'] = reverse('titulni_strana') | 		ctx['next'] = reverse('titulni_strana') | ||||||
| 		return ctx | 		return ctx | ||||||
|  | 
 | ||||||
|  | class LogoutView(auth_views.LogoutView): | ||||||
|  | 	# Jen vezmeme vestavěný a dáme mu vhodný template a přesměrovací URL | ||||||
|  | 	template_name = 'seminar/logout.html' | ||||||
|  | 	# Pavel: Vůbec nevím, proč to s _lazy funguje, ale bez toho to bylo rozbité. | ||||||
|  | 	next_page = reverse_lazy('titulni_strana') | ||||||
|  | 
 | ||||||
|  | class PasswordResetView(auth_views.PasswordResetView): | ||||||
|  | 	#template_name = 'seminar/password_reset.html' | ||||||
|  | 	# TODO: vlastní email_template_name a subject_template_name a html_email_template_name | ||||||
|  | 	success_url = reverse_lazy('reset_password_done') | ||||||
|  | 	from_email = 'login@mam.mff.cuni.cz' | ||||||
|  | 	# TODO: přepsat User-a :-( | ||||||
|  | 
 | ||||||
|  | class PasswordResetDoneView(auth_views.PasswordResetDoneView): | ||||||
|  | 	#template_name = 'seminar/password_reset_done.html' | ||||||
|  | 	pass | ||||||
|  | 
 | ||||||
|  | class PasswordResetConfirmView(auth_views.PasswordResetConfirmView): | ||||||
|  | 	#template_name = 'seminar/password_confirm_done.html' | ||||||
|  | 	success_url = reverse_lazy('reset_password_complete') | ||||||
|  | 
 | ||||||
|  | class PasswordResetCompleteView(auth_views.PasswordResetCompleteView): | ||||||
|  | 	#template_name = 'seminar/password_complete_done.html' | ||||||
|  | 	pass | ||||||
|  | 
 | ||||||
|  | class PasswordChangeView(auth_views.PasswordChangeView): | ||||||
|  | 	#template_name = 'seminar/password_change.html' | ||||||
|  | 	success_url = reverse_lazy('titulni_strana') | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue
	
	 Pavel 'LEdoian' Turinsky
						Pavel 'LEdoian' Turinsky