Hi Team,
I created successfully the signup function based on your docs:
signup = async() => {
const user = new Moralis.User();
user.set("username", document.getElementById("user-username-new").value);
user.set("email", document.getElementById("user-email-new").value);
user.set("password", document.getElementById("user-password").value);
try {
await user.signUp();
// Hooray! Let them use the app now.
alert("Successfully Signed Up! Login With MetaMask");
console.log(user)
} catch (error) {
// Show the error message somewhere and let the user try again.
alert("Error: " + error.code + " " + error.message);
console.log(user)
}
}
In my login function I would like to check if the user is signed up based on his āuser-usernameā and āuser-useremailā. If he is not signed up, then authenticate() should not work and print a notification. Any idea how to change the below login function()
login = async() => {
console.log(user)
await Moralis.Web3.authenticate().then(async function(user) {
console.log('logged in');
user.set("name", document.getElementById("user-username").value);
user.set("email", document.getElementById('user-email').value);
await user.save();
window.location.href = "dashboard.html";
})
}