|
|
|
|
@ -23,7 +23,7 @@ from django.utils.translation import ugettext_lazy as _ |
|
|
|
|
|
|
|
|
|
from core.views import ProtectedView |
|
|
|
|
from .forms import ( |
|
|
|
|
PasswordResetRequestForm, PasswordResetForm, RegistrationCompanyForm, |
|
|
|
|
PasswordResetRequestForm, SetPasswordForm, RegistrationCompanyForm, |
|
|
|
|
AuthenticationForm, |
|
|
|
|
RegistrationForm) |
|
|
|
|
|
|
|
|
|
@ -66,21 +66,19 @@ class ResetPasswordView(PasswordResetViewBase): |
|
|
|
|
html_email_template_name = 'emails/password_reset_email.html' |
|
|
|
|
success_url = reverse_lazy('accounts_ext:reset_password_done') |
|
|
|
|
from_email = settings.DEFAULT_FROM_EMAIL |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
|
context['title'] = PasswordResetForm.title |
|
|
|
|
return context |
|
|
|
|
title = PasswordResetRequestForm.title |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResetPasswordDoneView(PasswordResetDoneViewBase): |
|
|
|
|
template_name = 'accounts_ext/reset_password_done.html' |
|
|
|
|
title = _('Ссылка на сброс пароля отправленна') |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResetPasswordConfirmView(PasswordResetConfirmViewBase): |
|
|
|
|
form_class = SetPasswordForm |
|
|
|
|
template_name = 'accounts_ext/reset_password_change.html' |
|
|
|
|
success_url = reverse_lazy('accounts_ext:reset_password_complete') |
|
|
|
|
title = SetPasswordForm.title |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class ResetPasswordCompleteView(PasswordResetCompleteViewBase): |
|
|
|
|
@ -91,16 +89,22 @@ class ResetPasswordCompleteView(PasswordResetCompleteViewBase): |
|
|
|
|
class RegistrationView(RegistrationViewBase): |
|
|
|
|
http_method_names = ['get', 'post'] |
|
|
|
|
template_name = 'registration/registration.html' |
|
|
|
|
company_form = None |
|
|
|
|
|
|
|
|
|
def get_context_data(self, **kwargs): |
|
|
|
|
context = super().get_context_data(**kwargs) |
|
|
|
|
if self.request.POST: |
|
|
|
|
context['company_form'] = RegistrationCompanyForm(self.request.POST) |
|
|
|
|
else: |
|
|
|
|
context['company_form'] = RegistrationCompanyForm() |
|
|
|
|
context['company_form'] = self.company_form |
|
|
|
|
context['title'] = RegistrationForm.title |
|
|
|
|
return context |
|
|
|
|
|
|
|
|
|
def post(self, request, *args, **kwargs): |
|
|
|
|
self.company_form = RegistrationCompanyForm(self.request.POST) |
|
|
|
|
return super().post(request, *args, **kwargs) |
|
|
|
|
|
|
|
|
|
def get(self, request, *args, **kwargs): |
|
|
|
|
self.company_form = RegistrationCompanyForm() |
|
|
|
|
return super().get(request, *args, **kwargs) |
|
|
|
|
|
|
|
|
|
def form_valid(self, form): |
|
|
|
|
new_user = self.register(form) |
|
|
|
|
context = self.get_context_data() |
|
|
|
|
|