Check if email exists in PrivateMemberData

Hi,

I would like create a safe custom log in by:

  1. User enters email in the email input
  2. User clicks the “confirm” button
  3. If email exists; password field shows . But, if email does not exist; error message: “Email does not exist” shows

(I know how to create the custom log in; just confused how to check the email’s existence first)


This is my code, but this does not work; I want the action to take place when the user click the confirm button

 export function confirm_click(event) { 
 let email = $w('#email').value     
 wixData.query('PrivateMembersData')       
 .eq('emails', email)       
 .find()       
 .then((res) => {  
 if(res) {               
 $w('#password').show()           
 } else {    
 $w('#errorMessage').show()       
 })  
  }

the email field for PrivateMemberdata looks like this:
Field Name: Emails
Field Key: emails

I hope you can help me
Thanks in advance

This post is really good but i have another issue when i tried to check private email in my account but it hows an error windows defender error 577 , so I want a solution how to remove this error.

if you query the Wix Members app and its PrivateMembers Data collection, then you need to call it by it’s full name and make sure that you are using the correct email field.
https://support.wix.com/en/article/corvid-wix-members-privatemembersdata-collection-fields

wixData.query('Members/PrivateMembersData')