Skip to content

Saleor Core: the high performance, composable, headless commerce API.

Changes to codestyle, feature enable by environment variable

Tomasz Szymańskicb1f21f0e879
diff --git a/saleor/graphql/account/mutations/account.py b/saleor/graphql/account/mutations/account.py
index 3c622dcd12..81346bf4de 100644
--- a/saleor/graphql/account/mutations/account.py
+++ b/saleor/graphql/account/mutations/account.py
@@ -30,8 +30,9 @@ class AccountRegisterInput(graphene.InputObjectType):
email = graphene.String(description="The email address of the user.", required=True)
password = graphene.String(description="Password.", required=True)
redirect_origin = graphene.String(
- description="Base of frontend URL that will be "
- "needed to create confirmation URL.",
+ description=(
+ "Base of frontend URL that will be needed to create confirmation URL."
+ ),
required=True,
)
diff --git a/saleor/graphql/account/mutations/base.py b/saleor/graphql/account/mutations/base.py
index 88bde3484d..9e16ff299b 100644
--- a/saleor/graphql/account/mutations/base.py
+++ b/saleor/graphql/account/mutations/base.py
@@ -186,7 +186,7 @@ class ConfirmAccount(BaseMutation):
)
user.is_active = True
- user.save()
+ user.save(update_fields=["is_active"])
return ConfirmAccount()
diff --git a/saleor/settings.py b/saleor/settings.py
index 72256960b2..0787df10fd 100644
--- a/saleor/settings.py
+++ b/saleor/settings.py
@@ -128,7 +128,9 @@ EMAIL_BACKEND = email_config["EMAIL_BACKEND"]
EMAIL_USE_TLS = email_config["EMAIL_USE_TLS"]
EMAIL_USE_SSL = email_config["EMAIL_USE_SSL"]
-ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL = True
+ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL = os.environ.get(
+ "ENABLE_ACCOUNT_CONFIRMATION", True
+)
ENABLE_SSL = get_bool_from_env("ENABLE_SSL", False)
diff --git a/tests/api/test_account.py b/tests/api/test_account.py
index 39cfe10ed2..558f6c73a7 100644
--- a/tests/api/test_account.py
+++ b/tests/api/test_account.py
@@ -2173,7 +2173,7 @@ def test_account_confirmation(user_api_client, customer_user):
def test_account_confirmation_invalid_user(user_api_client, customer_user):
variables = {
- "email": "[email protected]",
+ "email": "[email protected]",
"token": default_token_generator.make_token(customer_user),
}
response = user_api_client.post_graphql(CONFIRM_ACCOUNT_MUTATION, variables)