diff --git a/apps/auth/forms.py b/apps/auth/forms.py
index 0baea362..6977a3c2 100644
--- a/apps/auth/forms.py
+++ b/apps/auth/forms.py
@@ -1,4 +1,5 @@
from django import forms
+from django.contrib.auth.forms import AuthenticationForm
class LearnerRegistrationForm(forms.Form):
@@ -8,6 +9,7 @@ class LearnerRegistrationForm(forms.Form):
password = forms.CharField()
-class LoginForm(forms.Form):
- email = forms.CharField()
- password = forms.CharField()
+class AuthenticationForm(AuthenticationForm):
+
+ def clean_username(self):
+ return self.cleaned_data.get('username', '').lower()
diff --git a/apps/auth/views.py b/apps/auth/views.py
index f6105e75..acb7712d 100644
--- a/apps/auth/views.py
+++ b/apps/auth/views.py
@@ -7,7 +7,6 @@ from facepy import GraphAPI
from facepy.exceptions import FacepyError
from django.contrib.auth import get_user_model, logout, login, views
-from django.contrib.auth.forms import AuthenticationForm
from django.core.files.base import ContentFile
from django.http import JsonResponse
from django.urls import reverse_lazy
@@ -20,7 +19,7 @@ from django.shortcuts import redirect
from apps.notification.utils import send_email
from apps.config.models import Config
-from .forms import LearnerRegistrationForm
+from .forms import LearnerRegistrationForm, AuthenticationForm
from .tokens import verification_email_token
User = get_user_model()
@@ -33,7 +32,7 @@ class LearnerRegistrationView(FormView):
def form_valid(self, form):
first_name = form.cleaned_data['first_name']
last_name = form.cleaned_data['last_name']
- email = form.cleaned_data['email']
+ email = form.cleaned_data['email'].lower()
password = form.cleaned_data['password']
user, created = User.objects.get_or_create(
@@ -170,6 +169,7 @@ class FacebookLoginOrRegistration(View):
"errors": {"email": 'is field required'}
})
else:
+ email = email.lower()
try:
user = User.objects.get(email=email)
except User.DoesNotExist:
diff --git a/apps/course/models.py b/apps/course/models.py
index 942a0593..72cfad97 100644
--- a/apps/course/models.py
+++ b/apps/course/models.py
@@ -7,6 +7,7 @@ from django.utils.text import slugify
from django.utils.timezone import now
from django.contrib.auth import get_user_model
from django.urls import reverse_lazy
+from django.conf import settings
from polymorphic_tree.models import PolymorphicMPTTModel, PolymorphicTreeForeignKey
from project.mixins import BaseModel, DeactivatedMixin
@@ -129,11 +130,11 @@ class Course(BaseModel, DeactivatedMixin):
@property
def deferred_start_at_humanize(self):
- return arrow.get(self.deferred_start_at).humanize(locale='ru')
+ return arrow.get(self.deferred_start_at, settings.TIME_ZONE).humanize(locale='ru')
@property
def created_at_humanize(self):
- return arrow.get(self.created_at).humanize(locale='ru')
+ return arrow.get(self.created_at, settings.TIME_ZONE).humanize(locale='ru')
@property
def is_deferred_start(self):
@@ -234,7 +235,7 @@ class Comment(PolymorphicMPTTModel, DeactivatedMixin):
@property
def created_at_humanize(self):
- return arrow.get(self.created_at).humanize(locale='ru')
+ return arrow.get(self.created_at, settings.TIME_ZONE).humanize(locale='ru')
def __str__(self):
return self.content
diff --git a/apps/course/templates/course/content/imagetext.html b/apps/course/templates/course/content/imagetext.html
index 6385391e..80c6797a 100644
--- a/apps/course/templates/course/content/imagetext.html
+++ b/apps/course/templates/course/content/imagetext.html
@@ -9,7 +9,7 @@
-