Skip to content

MongocampRegister ​

Server 3.0 registration page (AUTH_REGISTRATION=open or invite) — put it on the page of paths.register (default /register), the path of the invitation links the server mails. The page must be public (outside the protected routes).

vue
<!-- pages/register.vue -->
<template>
  <MongocampRegister />
</template>
  • Open registration — e-mail address, optional display name, password (at least minPasswordLength, the server's AUTH_PASSWORD_MIN_LENGTH) and its repetition ⇒ useMongocampAuth().register(…). The server answers 202 whether or not the address exists, so the page always says if the address can be registered, a confirmation mail is on its way — the link goes to MongocampVerifyEmail. With AUTH_REQUIRE_VERIFIED_EMAIL the user can log in only after confirming.
  • Invitation — with ?token= (the link of an invitation from MongocampUsers' Invite User) the heading is Accept the invitation and the token goes with the registration as inviteToken: the address counts as confirmed and the user gets the invitation's roles; the page then offers Log in. A used, expired or unknown invitation (400, code 4403) says so.
  • Registration switched off (404) ⇒ Registration is not open on this server.; too many attempts (429) ⇒ the wait; other refusals ⇒ the server's message.
  • In server proxy mode a note instead of the form (there is no login).

The server sends no mail itself — the app listens to the Nitro hook mongocamp:auth:mail (see Authentication flows).

Props ​

PropTypeDefaultDescription
minPasswordLengthnumber8The server's AUTH_PASSWORD_MIN_LENGTH.
loginPathstringmodule option loginPathWhere Log in goes after the registration.
hideHeadingbooleanfalseHide the heading inside the card.

Slots and events ​

header / footer slots inside the card, like MongocampLogin. registered({ email, invited }) after the server took the registration.

Released under the MIT License.