Problem/Motivation

Currently, the VerifyEmailForm will only display the verification form if the user is not logged in. Logged in users will be directed to the destination page immediately. This makes the module inflexible as sites may want to use it for logged in users.

Steps to reproduce

Create a verification form. Go to form URL as any logged in user. Verify redirect to destination occurs.

Proposed resolution

"skip verify $id" permission has been created, so change check on form to only redirect for users with permission.

Remaining tasks

  1. This issue is dependent on #3556368: Create custom permissions per verification form, so check that has been merged.
  2. In the BuildForm function, after saving the entity to the form state, add $id = $entity->id()
  3. Edit VerifyEmailForm and change $this->currentUser()->isAuthenticated() to $this->currentUser->hasPermission('skip verify $id')
  4. In VerifyEmailRoutingTest:
    • Add a new skipUser class property.
    • In setUp, after saving the VerifyEmail entity, use drupalCreateUser to create a user with "skip verify verify_email_test" permission, and assign to the $this->skipUser property.
    • Replicate the testVerifyEmailRouteAuthenticatedUser function and give the copy a new name, and change to login as $this->skipUser.
    • Change the original testVerifyEmailRouteAuthenticatedUser to check the path remains "/verify-email-form", since the admin user doesn't have the "Skip" permission.
    • Update comment on both functions to explain the permission difference.

User interface changes

None.

API changes

None.

Data model changes

None.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

lostcarpark created an issue. See original summary.

lostcarpark’s picture

Issue summary: View changes

#3556368: Create custom permissions per verification form is now merged and fixed, so this issue is safe to proceed with.

ritarshi_chakraborty’s picture

Working on it.

ritarshi_chakraborty’s picture

Status: Active » Needs review

Please review my MR.

lostcarpark’s picture

Status: Needs review » Reviewed & tested by the community

Thank you for working on this.

I have reviewed the change, and I have carried out a manual test, and I'm happy this is working as expected.

lostcarpark’s picture

Status: Reviewed & tested by the community » Fixed

Thank you for working on this, @ritarshi_chakraborty.

Change merged and contribution credit awarded.

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.