Url verification redirect a custom url

Created on 17 April 2023, about 1 year ago
Updated 20 April 2023, about 1 year ago

Problem/Motivation

custom url verification redirect

The module is useful but the problem is presented to me in a specific case: When they click on the activation link https://example.com/user/registrationpassword/3/1681752130/EgxOhSR4-mLcw... I need it to be redirect to another url and not the default /user/2 for example that redirects to https://example.com/myaccount

📌 Task
Status

Needs review

Version

1.1

Component

Code

Created by

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @Nelo_Drup
  • Assigned to shailja179
  • Status changed to Needs review about 1 year ago
  • 🇮🇳India shailja179 India

    This is the code for redirection of email link.
    user_email_verification/src/Controller/UserEmailVerificationVerify.php

    // The user is already authenticated, redirect to the user profile.
          elseif ($this->currentUser()->isAuthenticated()) {
            return $this->redirect('entity.user.canonical', ['user' => $this->currentUser()->id()]);
          }

    If you have enabled extended verification period, then below code is responsible.
    user_email_verification/src/Controller/UserEmailVerificationVerifyExtended.php

    if ($this->currentUser()->isAuthenticated()) {
            return $this->redirect('entity.user.canonical', ['user' => $this->currentUser()->id()]);
          }
    

    You can add patch to these files to override the url using below code.
    new RedirectResponse('/myaccount/'))->send();

  • Thanks, I was able to do it, but just as a suggestion, I hope that in the future a field can be created where that can be customized, especially for new users who don't know how to code much.

  • 🇮🇳India shailja179 India

    Yes, that can be done using setting form. You want that or it will work for now?

  • #4 If it could be done from a form it would be great normal and just filling the path would be great

Production build 0.69.0 2024