End registration

remotes/origin/1203
Nazar Kotyuk 11 years ago
parent 848a15bc70
commit 4e0ab73339
  1. 2
      accounts/forms.py
  2. 114
      password_reset/templates/password_reset/recovery_email_expo.html
  3. 38
      password_reset/views.py
  4. 17
      proj/urls.py
  5. 14
      templates/client/blank.html
  6. 2
      templates/client/popups/user_information.html
  7. 3
      templates/registration/activation_complete.html

@ -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],

@ -0,0 +1,114 @@
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html style="margin: 0; padding: 0; height: 100%;">
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
</head>
<body style="margin: 0; padding: 0; min-height: 100%; background: #f4f2ee;">
<table cellpadding="0" cellspacing="0" border="0" width="100%" height="100%" bgcolor="#f4f2ee" style="font-family: Arial, sans-serif; background: #f4f2ee;">
<tr>
<td align="center" style="padding: 50px 0">
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px;">
<tr>
<td style="vertical-align: top;">
<div class="logo">
<a style="text-decoration: none; color: #a2a2a2; font-size: 12px;" href="#">
<img src="cid:logo" alt="Expomap.ru" />
<b style="display: block; padding-left: 67px; margin-top: -5px;">Выставки, конференции, семинары</b>
</a>
</div>
</td>
<td style="vertical-align: top; padding-top: 22px;">
<ul class="t-links" style="margin: 0 0 15px; padding: 0; list-style: none; text-align: right; font-size: 16px; line-height: 17px; font-weight: bold;">
<li style="display: inline-block;"><a style="text-decoration: none; color: #ff6600" href="#">СОБЫТИЯ</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">МЕСТА</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">УЧАСТНИКИ</a></li>
</ul>
<ul class="soc-media-buttons" style="margin: 0; padding: 0; list-style: none; text-align: right;">
<li style="display: inline-block;"><a href="#"><img src="cid:rss" title="RSS" alt="RSS" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:fb" title="Facebook" alt="Facebook" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:linkedin" title="LinkedIn" alt="LinkedIn" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:vk" title="В контакте" alt="В контакте" /></a></li>
<li style="display: inline-block; margin-left: 5px;"><a href="#"><img src="cid:twit" title="Twitter" alt="Twitter" /></a></li>
</ul>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; margin-bottom: 10px;">
<tr>
<td style="padding: 20px 0 0;"><p style="display: block; padding: 25px 30px; text-decoration: none; background: #ff6600; color: #ffffff; font-size: 20px; line-height: 26px; margin-bottom: 0;" >Воостановление пароля на портале <a href="http://expomap.ru/" style="color: #ffffff;text-decoration: none;border-bottom: 1px dashed #ee3824;">Expomap</a></p></td>
</tr>
<tr>
<td style="padding: 10px 30px 15px; background: #faf9f7;">
<table cellpadding="0" cellspacing="0" border="0" width="540" style="margin-bottom: 15px;">
<tr valign="top">
<td style="padding: 15px 0 36px 0;">
<p style="font-weight: bold;color: #003e79;margin: 0;">Добрый день, {{ user.first_name }}!</p>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 23px 0;">
Вы или кто-то еще сделал запрос на сброс пароля на сайте <a href="{{ domain }}" style="text-decoration: none;border-bottom: 1px dashed #ee3824;color: #645a5a;">{{ domain }}</a>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 32px 0;">
Вы можете восстановить доступ, нажав на кнопку ниже и указав новый пароль:
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 32px 0; text-align: center;">
<a class="button" style="display: inline-block; padding: 4px 10px 3px; text-decoration: none; color: #2592c5; font-size: 14px; font-weight: bold; line-height: 14px; border: 1px solid #90c7e0; text-transform: uppercase; -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; width: 336px;" href="http{% if secure %}s{% endif %}://{{ site.domain }}{% url "password_reset_reset" token %}">востановить пароль</a>
</td>
</tr>
<tr valign="top">
<td style="padding: 0 0 20px 0; text-align: left; ">
Если вы не хотите сбрасывать пароль, просто <span style="border-bottom: 1px dashed #ee3824;">проигнорируйте</span> это сообщение
</td>
</tr>
</table>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; border-bottom: 1px dotted #cccccc;">
<tr>
<td style="vertical-align: top; padding: 15px 0 10px;">
<div class="logo">
<a style="text-decoration: none; color: #a2a2a2; font-size: 12px;" href="#">
<img src="cid:logo2" alt="Expomap.ru" />
</a>
</div>
</td>
<td style="vertical-align: top; padding: 25px 0 5px;">
<ul class="t-links" style="margin: 0 0 15px; padding: 0; list-style: none; text-align: right; font-size: 14px; line-height: 15px; font-weight: bold;">
<li style="display: inline-block;"><a style="text-decoration: none; color: #ff6600" href="#">СОБЫТИЯ</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">МЕСТА</a></li>
<li style="display: inline-block; margin-left: 20px;"><a style="text-decoration: none; color: #ff6600" href="#">УЧАСТНИКИ</a></li>
</ul>
</td>
</tr>
</table>
<table cellpadding="0" cellspacing="0" border="0" width="600" style="width: 600px; font-size: 12px; line-height: 15px;">
<tr>
<td style="vertical-align: top; padding: 15px 0 15px; color: #a2a2a2; text-align: right;">
© 2018 — 2013 <a style="color: #a2a2a2; text-decoration: none;" href="#">Expomap.ru</a>
</td>
</tr>
</table>
</td>
</tr>
</table>
</body>
</html>

@ -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']

@ -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')),
)

@ -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 %}
<script type="text/javascript" src="{% static 'client/js/pages/complete_registration.js' %}"></script>
{% endif %}
{% endif %}
@ -128,7 +117,6 @@ This template include basic anf main styles and js files,
{% endblock %}
<!-- scripts -->
<script src="https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false"></script>
<!--vendor scripts concatenated-->
<script type="text/javascript" src="{% static 'client/js' %}{% if debug %}/{% else %}_min/{% endif %}vendor{% if debug %}{% else %}.min{% endif %}.js"></script>

@ -48,4 +48,4 @@
</div>
</div>
<!--Завершение регистрации--
<!--Завершение регистрации-->

@ -14,8 +14,5 @@
</div>
</div>
{% endblock %}
Loading…
Cancel
Save