parse-community / parse-community/parse-server

buildEmailLink should include locale

Open
#7,821 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

type:docs
Dominant language
JavaScript
Stars
21.4k
Forks
4.8k
Avg merge
7h 45m
Merged PRs (30d)
11

Description

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:

https://github.com/parse-community/parse-server/blob/4c29d4d23b67e4abaf25803fe71cae47ce1b5957/src/Controllers/UserController.js#L329

Example Use Case
Alternatives / Workarounds

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

Tried on beta4

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with buildEmailLink in src/Controllers/UserController.js, then compare the page definitions in PagesRouters.js, the generated URL in Config.js, and the linked pages documentation. Determine the intended locale format and route naming, then verify that generated email links and localized success pages follow the documented behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, node.js
Domain
backend, internationalization, localization
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.