diff --git a/accounts/forms.py b/accounts/forms.py index ede4846e..966a21e0 100644 --- a/accounts/forms.py +++ b/accounts/forms.py @@ -221,7 +221,7 @@ class RegistrationCompleteForm(forms.ModelForm): country = forms.ChoiceField(label='Страна', choices=[(c.id, c.name) for c in Country.objects.all()], widget=forms.Select(attrs={'class': 'select2'})) city = forms.CharField(label='Город', widget=forms.HiddenInput()) - url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'адрес страны(обязательно)')})) + url = forms.CharField(widget=forms.TextInput(attrs={'placeholder': _(u'url(обязательно)')})) code_country = forms.ChoiceField(label=_(u'код страны'), initial='70', choices=[(str(c.phone_code), '+'+str(c.phone_code)) for c in Country.objects.all() if c.phone_code is not None], diff --git a/password_reset/templates/password_reset/recovery_email_expo.html b/password_reset/templates/password_reset/recovery_email_expo.html new file mode 100644 index 00000000..cfcca57d --- /dev/null +++ b/password_reset/templates/password_reset/recovery_email_expo.html @@ -0,0 +1,114 @@ + + + + + + + + + + + +
+ + + + + + +
+ + + + +
    +
  • RSS
  • +
  • Facebook
  • +
  • LinkedIn
  • +
  • В контакте
  • +
  • Twitter
  • +
+
+ + + + + + + + +

Воостановление пароля на портале Expomap

+ + + + + + + + + + + + + + + + + + + +
+

Добрый день, {{ user.first_name }}!

+
+ Вы или кто-то еще сделал запрос на сброс пароля на сайте {{ domain }} +
+ Вы можете восстановить доступ, нажав на кнопку ниже и указав новый пароль: +
+ востановить пароль +
+ Если вы не хотите сбрасывать пароль, просто проигнорируйте это сообщение +
+ + + +
+ + + + + + +
+ + + +
+ + + + +
+ © 2018 — 2013 Expomap.ru +
+ +
+ + \ No newline at end of file diff --git a/password_reset/views.py b/password_reset/views.py index 88b84a07..8f1fd143 100644 --- a/password_reset/views.py +++ b/password_reset/views.py @@ -1,15 +1,18 @@ import datetime - +from django.core.mail import EmailMessage from django.conf import settings from django.contrib.sites.models import Site, RequestSite from django.core import signing from django.core.mail import send_mail +from django.template import Context from django.core.urlresolvers import reverse, reverse_lazy from django.shortcuts import get_object_or_404, redirect from django.http import Http404 from django.template import loader from django.utils import timezone from django.views import generic +from django.template.loader import get_template +from email.MIMEImage import MIMEImage from .forms import PasswordRecoveryForm, PasswordResetForm from .utils import get_user_model, get_username @@ -52,7 +55,7 @@ class Recover(SaltMixin, generic.FormView): form_class = PasswordRecoveryForm template_name = 'password_reset/recovery_form.html' success_url_name = 'password_reset_sent' - email_template_name = 'password_reset/recovery_email.txt' + email_template_name = 'password_reset/recovery_email_expo.html' email_subject_template_name = 'password_reset/recovery_email_subject.txt' search_fields = ['username', 'email'] @@ -85,12 +88,35 @@ class Recover(SaltMixin, generic.FormView): 'token': signing.dumps(self.user.pk, salt=self.salt), 'secure': self.request.is_secure(), } - body = loader.render_to_string(self.email_template_name, - context).strip() + + #body = loader.render_to_string(self.email_template_name, + # context).strip() + message = get_template(self.email_template_name).render(Context(context)) subject = loader.render_to_string(self.email_subject_template_name, context).strip() - send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, - [self.user.email]) + + msg = EmailMessage(subject, message, settings.DEFAULT_FROM_EMAIL, [self.user.email]) + msg.content_subtype = "html" + + images =(('/img/logo_reg.png', 'logo'), + ('/img/soc-medias/sm-icon-rss.png', 'rss'), + ('/img/soc-medias/sm-icon-fb.png', 'fb'), + ('/img/soc-medias/sm-icon-lin.png', 'linkedin'), + ('/img/soc-medias/sm-icon-vk.png', 'vk'), + ('/img/soc-medias/sm-icon-twit.png', 'twit'), + ('/img/mail-logo-2.jpg','logo2')) + for img in images: + fp = open(settings.STATIC_ROOT+img[0], 'rb') + msg_img = MIMEImage(fp.read()) + fp.close() + msg_img.add_header('Content-ID', '<'+img[1]+'>') + msg.attach(msg_img) + + + msg.send() + + #send_mail(subject, body, settings.DEFAULT_FROM_EMAIL, + # [self.user.email]) def form_valid(self, form): self.user = form.cleaned_data['user'] diff --git a/proj/urls.py b/proj/urls.py index f20bfd65..2134a8fb 100644 --- a/proj/urls.py +++ b/proj/urls.py @@ -9,6 +9,8 @@ from place_exposition.views import PlaceSearchView from django.http import HttpResponse + + urlpatterns = patterns('', url(r'^admin/', include('proj.admin_urls')), url(r'^$', MainPageView.as_view()), @@ -67,6 +69,18 @@ urlpatterns = patterns('', ) +# test urls +from accounts.models import User +def delete_user(request): +# User.objects.filter(email='kotzillla@gmail.com').delete() + return HttpResponse('deleted') + +urlpatterns += patterns('', + url(r'^delete-user/', delete_user), + + ) + + # ajax urls urlpatterns += patterns('', url(r'^register/', 'registration.backends.default.views.RegisterAjaxView'), @@ -78,9 +92,6 @@ urlpatterns += patterns('', url(r'^search-form/autosearch/exposition/$', 'settings.views.expo_autosearch'), url(r'^search-form/autosearch/place/$', 'settings.views.place_autosearch'), url(r'^search-form/autosearch/company/$', 'settings.views.company_autosearch'), - - - url(r'^', include('accounts.user_catalog_urls')), ) diff --git a/templates/client/blank.html b/templates/client/blank.html index 4311dc67..9b2eafce 100644 --- a/templates/client/blank.html +++ b/templates/client/blank.html @@ -98,18 +98,6 @@ This template include basic anf main styles and js files, {% endif %} - - {% comment "Убрал т.к. функционал диалоговых окон расширенного поиска переносится в catalog_search.html" %} - {% include 'client/popups/theme.html' %} - {% if search_form.area %} - {% include 'client/popups/place.html' with search_form=search_form search_action=search_action %} - {% endif %} - {% if search_form.fr %} - {% with search_form=search_form search_action=search_action type=type%} - {% include 'client/popups/period.html' %} - {% endwith %} - {% endif %} - {% endcomment %} {% include 'client/popups/callback.html' %} {# if user doesnt have url- show form #} @@ -117,6 +105,7 @@ This template include basic anf main styles and js files, {% if not request.user.is_anonymous %} {% if not request.user.url %} {% include 'client/popups/user_information.html' with form=reg_complete %} + {% endif %} {% endif %} @@ -128,7 +117,6 @@ This template include basic anf main styles and js files, {% endblock %} - diff --git a/templates/client/popups/user_information.html b/templates/client/popups/user_information.html index b585b685..3e6f3208 100644 --- a/templates/client/popups/user_information.html +++ b/templates/client/popups/user_information.html @@ -48,4 +48,4 @@ - diff --git a/templates/registration/activation_complete.html b/templates/registration/activation_complete.html index 3e079ba5..1212c67d 100644 --- a/templates/registration/activation_complete.html +++ b/templates/registration/activation_complete.html @@ -14,8 +14,5 @@ - - - {% endblock %} \ No newline at end of file