I have a few forms for signing in/up or continuing as guest using the firebase. I want the user to be forced to put in an email so I can identify the user when they come to pick up their order and send them a receipt after they've paid. There is nothing preventing the user from just inspecting element and removing the required field, and the firebase functions are called from the front end so I cant even use my server to double check there is an email.
Is there a way to mitigate this? Aside from Firebase specific solutions, is there a way to mitigate this issue with all required fields? There is obviously a way as other websites implement this but I'm not sure how
Maybe run a script to check if the required attribute has been removed but that too can be deleted or edited.
You can check if the field in question exists and has a value.
const form = document.forms.form;
form.onsubmit = () => {
event.preventDefault();
signInAnonymously(event.currentTarget.elements.email);
};
function signInAnonymously(email) {
if (email && email.value) {
console.log("Authenticate with Firebase anonymously");
} else {
console.log("Email is required")
}
}
<form name="form">
<label>
<b>Email:</b>
<input name="email" type="email" required>
</label>
<button>Sign In Anonymously</button>
</form>