Search.../

approveByEmail( )

Approve a member whose status is "Pending" using an email address.

Description

The approveByEmail() function returns a Promise that resolves to a session token when the specified user is approved.

A member's status is "Pending" after you've called the register() function when the site's membership policy is set to manual approval. To learn more about setting your site's membership approval policy, see Editing Your Member Signup Settings.

Pass the member's email address in the email parameter.

Syntax

function approveByEmail(email: string): Promise<string>

approveByEmail Parameters

NAME
TYPE
DESCRIPTION
email

string

Email address of the user to approve.

Returns

Fulfilled - A session token for logging in the approved user in client-side code. Rejected - Error message.

Return Type:

Promise<string>

Was this helpful?

Approve a pending member using an email address

This example contains a backend function which approves a pending user using an email address and returns a session token to be used in client-side code to log in the user who was just approved.

Code Example

Copy Code
1import wixUsersBackend from 'wix-users-backend';
2
3export function myBackendFunction(email) {
4 return wixUsersBackend.approveByEmail(email)
5 .then( (sessionToken) => {
6 return {sessionToken, "approved": true};
7 } )
8 .catch( (error) => {
9 return {"approved": false, "reason": error};
10 } );
11}
12