I have a problem with account cancellation. The proccess itself executes fine, but after the batch proccess runs, the user isn't redirected to the front page as mentioned in the UserController::confirmCancel method:

user_cancel($edit, $user->id(), $account_data['cancel_method']);
// Since user_cancel() is not invoked via Form API, batch processing
// needs to be invoked manually and should redirect to the front page
// after completion.
return batch_process('');

This results in 403 error, as anonymous users don't have access to en/user/2/cancel/confirm/... path. I tested in in 2 different sites, using Drupal 8.2 and 8.3

How can I redirect user properly in this situation?


I solved it using custom service. Will post it here shortly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.