|
@ -1478,36 +1478,6 @@ class NahrajReseniView(LoginRequiredMixin, CreateView): |
|
|
|
|
|
|
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
return HttpResponseRedirect(self.get_success_url()) |
|
|
|
|
|
|
|
|
def resetPasswordView(request): |
|
|
|
|
|
pass |
|
|
|
|
|
|
|
|
|
|
|
def loginView(request): |
|
|
|
|
|
if request.method == 'POST': |
|
|
|
|
|
form = LoginForm(request.POST) |
|
|
|
|
|
if form.is_valid(): |
|
|
|
|
|
user = authenticate(request, |
|
|
|
|
|
username=form.cleaned_data['username'], |
|
|
|
|
|
password=form.cleaned_data['password']) |
|
|
|
|
|
print(form.cleaned_data) |
|
|
|
|
|
if user is not None: |
|
|
|
|
|
login(request,user) |
|
|
|
|
|
return HttpResponseRedirect('/') |
|
|
|
|
|
else: |
|
|
|
|
|
return render(request, |
|
|
|
|
|
'seminar/profil/login.html', |
|
|
|
|
|
{'form': form, 'login_error': 'Neplatné jméno nebo heslo'}) |
|
|
|
|
|
|
|
|
|
|
|
else: |
|
|
|
|
|
form = LoginForm() |
|
|
|
|
|
return render(request, 'seminar/profil/login.html', {'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
def logoutView(request): |
|
|
|
|
|
form = LoginForm() |
|
|
|
|
|
if request.user.is_authenticated: |
|
|
|
|
|
logout(request) |
|
|
|
|
|
return render(request, 'seminar/profil/login.html', {'form': form, 'login_error': 'Byli jste úspěšně odhlášeni'}) |
|
|
|
|
|
return render(request, 'seminar/profil/login.html', {'form': form}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data): |
|
|
def prihlaska_log_gdpr_safe(logger, gdpr_logger, msg, form_data): |
|
|
msg = "{}, form_hash:{}".format(msg,hash(frozenset(form_data.items))) |
|
|
msg = "{}, form_hash:{}".format(msg,hash(frozenset(form_data.items))) |
|
@ -1656,7 +1626,7 @@ class LoginView(auth_views.LoginView): |
|
|
# Přesměrovací URL má být v kontextu: |
|
|
# Přesměrovací URL má být v kontextu: |
|
|
def get_context_data(self, **kwargs): |
|
|
def get_context_data(self, **kwargs): |
|
|
ctx = super().get_context_data(**kwargs) |
|
|
ctx = super().get_context_data(**kwargs) |
|
|
ctx['next'] = reverse('titulni_strana') |
|
|
ctx['next'] = reverse('profil') |
|
|
return ctx |
|
|
return ctx |
|
|
|
|
|
|
|
|
class LogoutView(auth_views.LogoutView): |
|
|
class LogoutView(auth_views.LogoutView): |
|
|