-
Notifications
You must be signed in to change notification settings - Fork 9.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Customer Account Registration Email Confirmation Flow #35233
Comments
@cpartica This completely covers all the functionality we talked about earlier on Slack. |
Code snippet how to confirm the customer we've used, should be easily implementable. type Mutation {
customerConfirmRegistration(
customerId: Int!,
confirmationToken: String!
): Boolean
@resolver(class: "\\ReachDigital\\VerdouwAccountFlow\\Model\\Resolver\\ConfirmCustomer")
@doc(description: "Confirm the customer account using the confirmation token that the customer received in an email after registering createCustomerV2.")
} <?php
namespace ReachDigital\VerdouwAccountFlow\Model\Resolver;
use Magento\Customer\Api\AccountManagementInterface;
use Magento\Framework\Exception\LocalizedException;
use Magento\Framework\Exception\NoSuchEntityException;
use Magento\Framework\Exception\State\InputMismatchException;
use Magento\Framework\Exception\State\InvalidTransitionException;
use Magento\Framework\GraphQl\Config\Element\Field;
use Magento\Framework\GraphQl\Exception\GraphQlInputException;
use Magento\Framework\GraphQl\Exception\GraphQlNoSuchEntityException;
use Magento\Framework\GraphQl\Query\ResolverInterface;
use Magento\Framework\GraphQl\Schema\Type\ResolveInfo;
class ConfirmCustomer implements ResolverInterface
{
private AccountManagementInterface $customerAccountManagement;
public function __construct(
AccountManagementInterface $customerAccountManagement
) {
$this->customerAccountManagement = $customerAccountManagement;
}
public function resolve(Field $field, $context, ResolveInfo $info, array $value = null, array $args = null): bool
{
$customerId = $args['customerId'];
$token = $args['confirmationToken'];
try {
$this->customerAccountManagement->activateById($customerId, $token);
return true;
} catch (InvalidTransitionException $e) {
throw new GraphQlInputException(__('The customer is already confirmed.'));
} catch (InputMismatchException $e) {
throw new GraphQlInputException(__('The given confirmationToken is invalid.'));
} catch (NoSuchEntityException $e) {
throw new GraphQlNoSuchEntityException(__('The customer was not found.'));
} catch (LocalizedException $e) {
throw new GraphQlInputException(__($e->getMessage()), $e);
}
}
} |
The above code posted by @paales is available as a module at https://github.com/ho-nl/magento2-ReachDigital_CustomerConfirmationGraphQl |
Any progress on this? I'm having the same issue, when create a customer via grapql I don't get any notification that suggest the customer needs a confirmation, it should include in the response if a confirmation is required b4 trying to sign in. Also when trying to sign in via graphql there is again no indication that it needs a confirmation. However from the web url
|
Hi @engcom-November. Thank you for working on this issue.
|
Hello @pawel-siejba, Thank you for the report and collaboration! Verified this issue on 2.4-develop.
Instead there should me a message to check if the email is confirmed or not. Also when creating the customer using the graphql/rest api, there is no indication if email confirmation is required or not. Hence the issue can be confirmed. Thank you. |
✅ Jira issue https://jira.corp.adobe.com/browse/AC-10958 is successfully created for this GitHub issue. |
✅ Confirmed by @engcom-November. Thank you for verifying the issue. |
Pwa studio: v14.1.0-alpha.2Magento v2.4.7-p2The issue still exists. A fix: would be helpful. Thank you |
As a customer I want to confirm my account registration so that I can login to my account when confirmation is required.
Not having this essentially breaks GraphQL customer registration flow when the "Require Emails Confirmation" option is turned on. https://docs.magento.com/user-guide/customers/account-options-new.html
Seems pretty urgent since nobody wants anybody to be able to create an account email with somebody else's email.
AC
Proposed Schema
To enable additional information when the customer tries to login but his account is not confirmed yet, something like this should be done:
The text was updated successfully, but these errors were encountered: