Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
Create active user.
Krzysiek Szularz03b77ac38d56
diff --git a/registration/models.py b/registration/models.pyindex 15bc6a7beb..6da8052b87 100644--- a/registration/models.py+++ b/registration/models.py@@ -37,7 +37,8 @@ class EmailConfirmation(models.Model):if self.external_user and self.external_user.user:return self.external_user.user- user, _created = User.objects.get_or_create(email=self.email)+ user, _created = User.objects.get_or_create(+ email=self.email, defaults={'is_active': True})if self.external_user:self.external_user.user = userdiff --git a/registration/templates/registration/login.html b/registration/templates/registration/login.htmlindex 2b79154ff4..437496fbd4 100644--- a/registration/templates/registration/login.html+++ b/registration/templates/registration/login.html@@ -1,24 +1,14 @@{% extends "base.html" %}+{% load bootstrap %}+{% block title %}Login{% endblock %}-{% block content %}-{% if form.errors %}-<p>Your username and password didn't match. Please try again.</p>-{% endif %}--<form method="post" action="{% url 'registration:login' %}">{% csrf_token %}-<table>-<tr>- <td>{{ form.username.label_tag }}</td>- <td>{{ form.username }}</td>-</tr>-<tr>- <td>{{ form.password.label_tag }}</td>- <td>{{ form.password }}</td>-</tr>-</table>-<input type="submit" value="login" />-<input type="hidden" name="next" value="{{ next }}" />+{% block content %}+<form method="post" action="{% url 'registration:login' %}">+ {% csrf_token %}+ {{ form|as_bootstrap }}+ <input type="submit" value="login" />+ <input type="hidden" name="next" value="{{ next }}" /></form><div>@@ -45,5 +35,4 @@<a href="{% url 'registration:register' %}">Create an account or reset password</a></p>-{% endblock %}diff --git a/registration/tests.py b/registration/tests.pyindex ea947165cb..17994ddffb 100644--- a/registration/tests.py+++ b/registration/tests.py@@ -337,7 +337,7 @@ class ConfirmationEmailTest(TestCase):self.assertTrue(User.objects.get(email=email).check_password(password))self.assertFalse(EmailConfirmation.objects.filter(pk=ec.pk).exists())- self.assertTrue(User.objects.filter(email=email).exists())+ self.assertTrue(User.objects.get(email=email).is_active)self.assertEqual(initial_user_count + 1, User.objects.count())self.assertEqual(302, response.status_code)@@ -352,8 +352,10 @@ class ConfirmationEmailTest(TestCase):'/account/confirm_email/%s/%s/' % (ec.id, ec.token),{'nopassword': None})+ user = User.objects.get(email=email)self.assertFalse(EmailConfirmation.objects.filter(pk=ec.pk).exists())- self.assertFalse(User.objects.get(email=email).has_usable_password())+ self.assertFalse(user.has_usable_password())+ self.assertTrue(user.is_active)self.assertEqual(initial_user_count + 1, User.objects.count())self.assertEqual(302, response.status_code)