Skip to content

buildEmailLink should include locale #7821

Open
@jonas-db

Description

@jonas-db

New Feature / Enhancement Checklist

Current Limitation

It seems that we have to include the locale ourselves in the email links generated by parse-server when we use the localization feature for pages (eg verify email).

  pages: {
    enableRouter: true, // Enables the experimental feature; required for localization
    enableLocalization: true,
    pagesPath: path.join(__dirname, 'static_pages'), 
  },

The link in the email is: .../verify_email?token=UqGZOpLog7HkF75fQiitxjHfy&username=ossmjmfdvpntnximhh%40nvhrw.com
while we would expect for example:
.../verify_email?token=UqGZOpLog7HkF75fQiitxjHfy&username=ossmjmfdvpntnximhh%40nvhrw.com&locale=nl-NL where nl-NL is the value of the field locale of the user


It also seems there is a mismatch between names? email_verification_successvs verify_email_success?

(PagesRouters.js):

    id: 'emailVerificationSuccess',
    defaultFile: 'email_verification_success.html',
  }),

yet the url that is generated by parse server: (Config.js):

    return (
      this.customPages.verifyEmailSuccess ||
      `${this.publicServerURL}/apps/verify_email_success.html`
    );
  }

We actually can't get the localization to work with the folder structure... include a &locale=nl-NL always returns the default page we provided in static_pages/verify_email_success.html. We have static_pages/nl-NL/verify_email_success.html and it is not picked up? Are we missing configuration?

EDIT: it seems we need to include the locale as .../nl-NL/verify_email..., this is not what is mentioned in the docs:
https://github.com/parse-community/parse-server#pages

Feature / Enhancement Description

After digging, it seems that the buildEmailLink should include the locale as a query parameter:

function buildEmailLink(destination, username, token, config) {

Example Use Case

Alternatives / Workarounds

Include the locale parameters ourselves in our own template: {{link}}&locale={{{locale}}}

Tried on beta4

Metadata

Metadata

Assignees

No one assigned

    Labels

    type:docsOnly change in the docs or README

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions