Saleor Core: the high performance, composable, headless commerce API.
Python cartcheckoutcommercecomposablee-commerceecommercegraphqlheadlessheadless-commercemultichannelomsorder-managementpaymentspimpythonshopshopping-cartstore
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.pyindex 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 = AccountErrorerror_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+@classmethoddef clean_input(cls, info, instance, data, input_cls=None):try:diff --git a/saleor/graphql/schema.graphql b/saleor/graphql/schema.graphqlindex 4488031999..e6a75a0542 100644--- a/saleor/graphql/schema.graphql+++ b/saleor/graphql/schema.graphql@@ -66,6 +66,7 @@ input AccountInput {type AccountRegister {errors: [Error!]+ requiresConfirmation: BooleanaccountErrors: [AccountError!]user: User}