register( )


Registers a new site member.

The register() function returns a Promise that resolves to a RegistrationResult object when the member is registered or pending registration.

The specified password must be between 4 and 100 ASCII characters.

See New Members to learn about verifying emails and approving members.

Notes:

  • The APIs in wix-members-frontend are only partially functional when previewing your site. View a published version of your site to see their complete functionality.

  • The member data in the resolved Promise includes custom fields from your site's contacts only if they are added to your site members in your dashboard.

  • When a new member signs up using an email address that's already in your site's Contact List, a notification is displayed and a confirmation email is sent to the new member. To register a member without displaying the notification, use register() from wix-members-backend (this does not suppress the confirmation email).

  • When your site's member signup settings are set to automatic approval, calling register() from wix-members-frontend (in page code) is as secure as calling register() from wix-members-backend (in backend code), unless you are implementing custom site registration using Velo forms. However, when registration is set to manual approval, calling register() from wix-members-backend allows you to build more secure approval flows by keeping tokens hidden from the frontend.

Method Declaration
Copy
function register(
  email: string,
  password: string,
  options: RegistrationOptions,
): Promise<RegistrationResult>;
Method Parameters
emailstringRequired

Email address the new member will use to log in.


passwordstringRequired

Password to assign to the new member. Must be 4 to 100 ASCII characters.


optionsRegistrationOptions

Registration options.

Returns
Return Type:Promise<RegistrationResult>
Register a site member

This example contains a custom field, "Hobby".

JavaScript
import { authentication } from "wix-members-frontend"; // ... /* Sample options value: * { * contactInfo: { * firstName: 'Juan', * lastName: 'Doe', * picture: 'https://static.parastorage.com/unpkg-semver/communities-blog-statics/assets/wix-logo.png', * hobby: 'Football' * }, * privacyStatus: "PRIVATE" * } */ authentication .register(email, password, options) .then((registrationResult) => { const status = registrationResult.status; if (status === "PENDING") { // When the site is configured for manual approval, // status is "PENDING" and approvalToken is returned. const approvalToken = registrationResult.approvalToken; console.log( "Member registered and waiting for approval:", registrationResult, ); } else { // When the site is configured for automatic approval, // status is "ACTIVE" and the member is approved and logged in. // To prevent logging in the member automatically, // use the backend function: wix-members-backend.authentication.register() console.log("Member registered and logged in:", registrationResult); } }) .catch((error) => { console.error(error); });
Errors

This method doesn’t return any custom errors, but may return standard errors. Learn more about standard Wix errors.

Did this help?