Skip to content

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

Registration response contains info if user requires email confirmation

Tomasz Szymańskic4e9a4f41d0c
diff --git a/saleor/graphql/account/mutations/account.py b/saleor/graphql/account/mutations/account.py
index 81346bf4de..1824ed047e 100644
--- a/saleor/graphql/account/mutations/account.py
+++ b/saleor/graphql/account/mutations/account.py
@@ -43,6 +43,8 @@ class AccountRegister(ModelMutation):
description="Fields required to create a user.", required=True
)
+ requires_confirmation = graphene.Boolean()
+
class Meta:
description = "Register a new user."
exclude = ["password"]
@@ -50,6 +52,15 @@ class AccountRegister(ModelMutation):
error_type_class = AccountError
error_type_field = "account_errors"
+ @classmethod
+ def mutate(cls, root, info, **data):
+ response = super().mutate(root, info, **data)
+ if not response.errors:
+ response.requires_confirmation = (
+ settings.ENABLE_ACCOUNT_CONFIRMATION_BY_EMAIL
+ )
+ return response
+
@classmethod
def clean_input(cls, info, instance, data, input_cls=None):
try:
diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphql
index 4488031999..e6a75a0542 100644
--- a/saleor/graphql/schema.graphql
+++ b/saleor/graphql/schema.graphql
@@ -66,6 +66,7 @@ input AccountInput {
type AccountRegister {
errors: [Error!]
+ requiresConfirmation: Boolean
accountErrors: [AccountError!]
user: User
}