diff --git a/apps/auth/templates/auth/login.html b/apps/auth/templates/auth/login.html
index e69de29b..861ed328 100644
--- a/apps/auth/templates/auth/login.html
+++ b/apps/auth/templates/auth/login.html
@@ -0,0 +1,49 @@
+{% extends "templates/lilcity/layer.html" %} {% load static %}
+
+{% block layer_body %}
+
Для восстановления пароля нажмите кнопку ниже.
-
-
Нажмите для восстановления
-
Или скопируйте ссылку ниже, и вставьте её в адресную строку браузера.
-
{{ domain }}{% url 'lilcity:password_reset_confirm' uidb64=uid token=token %}
+{% block layer_body %}
+
+ {% include "templates/blocks/header.html" with no_auth_btn=True %}
+
+
+
+
Восстановление пароля
+
+
+
+
-{% endblock content %}
+{% endblock layer_body %}
diff --git a/apps/auth/templates/auth/password_reset_email.html b/apps/auth/templates/auth/password_reset_email.html
new file mode 100644
index 00000000..a9a3af16
--- /dev/null
+++ b/apps/auth/templates/auth/password_reset_email.html
@@ -0,0 +1,14 @@
+{% extends "notification/email/_base.html" %}
+
+{% block content %}
+
Для восстановления пароля нажмите кнопку ниже.
+
+
Нажмите для восстановления
+
Или скопируйте ссылку ниже, и вставьте её в адресную строку браузера.
+
{{ domain }}{% url 'lilcity:password_reset_confirm' uidb64=uid token=token %}
+
+{% endblock content %}
diff --git a/apps/auth/templates/auth/password_reset.txt b/apps/auth/templates/auth/password_reset_email.txt
similarity index 100%
rename from apps/auth/templates/auth/password_reset.txt
rename to apps/auth/templates/auth/password_reset_email.txt
diff --git a/apps/auth/templates/auth/registration-learner.html b/apps/auth/templates/auth/registration-learner.html
index de155ea5..46480246 100644
--- a/apps/auth/templates/auth/registration-learner.html
+++ b/apps/auth/templates/auth/registration-learner.html
@@ -1,10 +1,92 @@
-
-
-
-
-
Title
-
-
-
-
-
\ No newline at end of file
+{% extends "templates/lilcity/layer.html" %} {% load static %}
+
+{% block layer_body %}
+
+ {% include "templates/blocks/header.html" with no_auth_btn=True %}
+
+
+{% endblock layer_body %}
diff --git a/apps/auth/views.py b/apps/auth/views.py
index 5db4d77c..d85a75aa 100644
--- a/apps/auth/views.py
+++ b/apps/auth/views.py
@@ -31,6 +31,7 @@ User = get_user_model()
class LearnerRegistrationView(FormView):
form_class = LearnerRegistrationForm
template_name = "auth/registration-learner.html"
+ success_url = '/'
def form_valid(self, form):
config = Config.load()
@@ -44,10 +45,15 @@ class LearnerRegistrationView(FormView):
)
if not created:
- return JsonResponse({
- "success": False,
- 'errors': {'__all__': [{'message': 'Возможно вы уже зарегистрированы?'}]}
- }, status=400)
+ if self.request.is_ajax():
+ return JsonResponse({
+ "success": False,
+ 'errors': {'__all__': [{'message': 'Возможно вы уже зарегистрированы?'}]}
+ }, status=400)
+ else:
+ context = self.get_context_data(form=form)
+ context['error'] = 'Возможно вы уже зарегистрированы?'
+ return self.render_to_response(context)
user.username = email
user.first_name = first_name
@@ -71,10 +77,16 @@ class LearnerRegistrationView(FormView):
url = http_referer + str(reverse_lazy('lilcity:verification-email', args=[token, user.id]))
send_email('Вы успешно прошли регистрацию', email, "notification/email/verification_email.html", url=url, config=config)
- return JsonResponse({"success": True}, status=201)
+ if self.request.is_ajax():
+ return JsonResponse({"success": True}, status=201)
+ else:
+ return super().form_valid(form)
def form_invalid(self, form):
- return JsonResponse(form.errors.get_json_data(escape_html=True), status=400)
+ if self.request.is_ajax():
+ return JsonResponse(form.errors.get_json_data(escape_html=True), status=400)
+ else:
+ return super().form_invalid(form)
class LogoutView(View):
@@ -86,14 +98,21 @@ class LogoutView(View):
class LoginView(FormView):
form_class = AuthenticationForm
template_name = "auth/login.html"
+ success_url = '/'
def form_valid(self, form):
login(self.request, form.get_user())
self.request.session['referrer'] = None
- return JsonResponse({"success": True})
+ if self.request.is_ajax():
+ return JsonResponse({"success": True})
+ else:
+ return super().form_valid(form)
def form_invalid(self, form):
- return JsonResponse({"success": False, "errors": form.errors.get_json_data(escape_html=True)}, status=400)
+ if self.request.is_ajax():
+ return JsonResponse({"success": False, "errors": form.errors.get_json_data(escape_html=True)}, status=400)
+ else:
+ return super().form_invalid(form)
class VerificationEmailView(View):
@@ -116,20 +135,19 @@ class SuccessVerificationEmailView(TemplateView):
template_name = 'auth/success-verification.html'
-class PasswordResetView(views.PasswordContextMixin, BaseFormView):
- email_template_name = 'auth/password_reset.txt'
+class PasswordResetView(views.PasswordContextMixin, FormView):
+ email_template_name = 'auth/password_reset_email.txt'
subject_template_name = "auth/password_reset_subject.txt"
form_class = views.PasswordResetForm
+ template_name = "auth/password_reset.html"
+ success_url = '/'
extra_email_context = None
from_email = None
- html_email_template_name = "auth/password_reset.html"
+ html_email_template_name = "auth/password_reset_email.html"
title = 'Password reset'
token_generator = views.default_token_generator
- def get(self, *args, **kwargs):
- raise Http404()
-
def form_valid(self, form):
config = Config.load()
extra_email_context = {'config': config}
@@ -147,7 +165,10 @@ class PasswordResetView(views.PasswordContextMixin, BaseFormView):
'extra_email_context': extra_email_context,
}
form.save(**opts)
- return JsonResponse({"success": True})
+ if self.request.is_ajax():
+ return JsonResponse({"success": True})
+ else:
+ return super().form_valid(form)
class PasswordResetConfirmView(views.PasswordResetConfirmView):
diff --git a/apps/payment/tasks.py b/apps/payment/tasks.py
index e30f4e19..cc2e2f03 100644
--- a/apps/payment/tasks.py
+++ b/apps/payment/tasks.py
@@ -55,4 +55,11 @@ def transaction_to_roistat(user_id, payment_id, event_name, amount, time, status
key = settings.ROISTAT_KEY
url = settings.ROISTAT_API_URL + f'/project/add-orders?key={key}&project={project}'
resp = requests.post(url, json=body)
- logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp))
+ try:
+ resp_json = resp.json()
+ except:
+ resp_json = None
+ if resp.status_code != 200 or not resp_json or not resp_json.get('processed'):
+ logger.error('TRANSACTION_TO_ROISTAT for payment # %d, %s RUB: %s' % (payment_id, amount, resp.text))
+ else:
+ logger.info('TRANSACTION_TO_ROISTAT: ' + str(resp))
diff --git a/project/settings.py b/project/settings.py
index 0cfc970e..7a8ab32c 100644
--- a/project/settings.py
+++ b/project/settings.py
@@ -162,6 +162,64 @@ USE_L10N = True
# USE_TZ = True
+LOGGING = {
+ 'version': 1,
+ 'disable_existing_loggers': False,
+ 'filters': {
+ 'require_debug_false': {
+ '()': 'django.utils.log.RequireDebugFalse'
+ },
+ 'require_debug_true': {
+ '()': 'django.utils.log.RequireDebugTrue'
+ }
+ },
+ 'formatters': {
+ 'verbose': {
+ 'format': '%(levelname)s:%(name)s: %(message)s '
+ '(%(asctime)s; %(filename)s:%(lineno)d)',
+ 'datefmt': "%Y-%m-%d %H:%M:%S",
+ },
+ 'simple': {
+ 'format': '{levelname} {message}',
+ 'style': '{',
+ },
+ },
+ 'handlers': {
+ 'mail_admins': {
+ 'level': 'ERROR',
+ 'filters': ['require_debug_false'],
+ 'class': 'django.utils.log.AdminEmailHandler'
+ },
+ 'console': {
+ 'level': 'DEBUG',
+ 'filters': ['require_debug_true'],
+ 'class': 'logging.StreamHandler',
+ 'formatter': 'verbose',
+ },
+ 'sentry': {
+ 'level': 'WARNING',
+ 'class': 'raven.contrib.django.raven_compat.handlers.SentryHandler',
+ },
+ },
+ 'loggers': {
+ 'django.request': {
+ 'handlers': ['mail_admins', 'console'],
+ 'level': 'ERROR',
+ 'propagate': True,
+ },
+ 'django': {
+ 'handlers': ['console', ],
+ },
+ 'py.warnings': {
+ 'handlers': ['console', ],
+ },
+ '': {
+ 'handlers': ['sentry',],
+ 'level': "INFO",
+ },
+ }
+}
+
# Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/2.0/howto/static-files/
diff --git a/project/templates/blocks/lil_store_js.html b/project/templates/blocks/lil_store_js.html
index 67cd6d2c..1bbb297f 100644
--- a/project/templates/blocks/lil_store_js.html
+++ b/project/templates/blocks/lil_store_js.html
@@ -39,12 +39,13 @@
isGiftCertificateUrl: {{ is_gift_certificate_url|yesno:"true,false" }},
},
data: {},
- urlIs: (urlPatternNames) => {
+ urlIs: function(urlPatternNames) {
if(! Array.isArray(urlPatternNames)){
urlPatternNames = [urlPatternNames];
}
- return urlPatternNames.filter(
- urlPatternName => window.location.pathname.search(window.LIL_STORE.urls[urlPatternName]) > -1).length > 0;
+ return urlPatternNames.filter(function(urlPatternName){
+ return window.location.pathname.search(window.LIL_STORE.urls[urlPatternName]) > -1;
+ }).length > 0;
},
isIndexPage: window.location.pathname == '/',
};
diff --git a/project/templates/blocks/user_menu.html b/project/templates/blocks/user_menu.html
index b491686c..ae3b9a4b 100644
--- a/project/templates/blocks/user_menu.html
+++ b/project/templates/blocks/user_menu.html
@@ -47,6 +47,7 @@
{% else %}
-
+ {% if not no_auth_btn %}
+
+ {% endif %}
{% endif %}
diff --git a/project/templates/lilcity/index.html b/project/templates/lilcity/index.html
index 222f57ca..de69fbf1 100644
--- a/project/templates/lilcity/index.html
+++ b/project/templates/lilcity/index.html
@@ -5,28 +5,6 @@
{% load compress %}
{% block layer_head %}
-
-
-
-
-
{% block head %}{% endblock head %}
{% endblock layer_head %}
@@ -52,6 +30,7 @@
{% include "templates/blocks/popup_capture_email.html" %}
{% include "templates/blocks/popup_bonuses_came.html" %}
+ {% block foot %}{% endblock foot %}
{% include 'templates/blocks/lil_store_js.html' %}
{% block pre_app_js %}{% endblock pre_app_js %}
@@ -63,6 +42,27 @@
- {% block foot %}{% endblock foot %}
+
+
+
+
+
{% block foot_js %}{% endblock foot_js %}
{% endblock layer_body %}
diff --git a/project/templates/lilcity/layer.html b/project/templates/lilcity/layer.html
index 14293298..34915139 100644
--- a/project/templates/lilcity/layer.html
+++ b/project/templates/lilcity/layer.html
@@ -48,68 +48,69 @@
}
-
-
-