Skip to content

Enhancement: Persist redirect parameter in res.users to preserve customer journey during email verification #879

@benmaesdynapps

Description

@benmaesdynapps

Module

auth_signup_verify_email

Summary

Currently, when a user signs up from a specific context (e.g., /shop/cart, a specific event page, or a portal view), the ?redirect= parameter is lost during the "verify email" workflow. Once the user clicks the verification link and sets their password, they are redirected to the default home page or account page, breaking the flow.

This enhancement proposes storing the redirect value on the user record during the initial signup and retrieving it after the user completes the verification process.

Rationale

User Experience (UX): If a user attempts to check out but needs to sign up, they expect to be returned to the checkout page immediately after verifying their email and setting a password. Dropping them on the generic home page increases friction and cart abandonment.

Proposed Technical Implementation

1. Model Changes (res.users)
Add a new field to temporarily store the redirect URL.

Field Name: signup_redirect_url

Type: Char

Description: Stores the destination URL to redirect the user to after they verify their email and set a password.

2. Controller Changes (passwordless_signup)
Update the passwordless_signup method (or the method handling the initial form post) to:

Check for a redirect key in request.params.

If present, include signup_redirect_url in the values dictionary passed to the user creation method.

Note: Ensure signup_redirect_url is added to the safe/writable fields list if necessary, or explicitly write it to the user object after creation.

3. Verification Logic Changes
Update the verification/login controller (typically where the token is validated and the user is logged in) to:

Identify the user via the token.

Check if user.signup_redirect_url is set.

If set:

Assign this value to the response redirect.

Clear the value (write False to signup_redirect_url) to ensure it is not used again in the future.

If not set, fall back to the standard redirect behavior.

User Story / Workflow

User is on /shop and clicks "Sign Up" (URL: /web/signup?redirect=/shop).

User fills in name/email and submits.

System creates res.users record and saves /shop into signup_redirect_url.

User receives an email with a verification link.

User clicks the link, sets their password, and confirms.

System reads /shop from the user record, clears the field, and redirects the user back to /shop.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions