How do I securely send sensitive data like passwords to the server?
Is POST as a method enough? How do I enable https?
<form method="POST" action="/login">
Password:
<input type="password" name="pass">
<button type="submit">
Login
</button>
</form>
Or when using an eventhandler for some button on the page, how do I enable https here:
button.addEventListener("click", function(event) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function() {
if (this.readyState == 4 && this.status == 200) {
// do something
}
};
xhttp.open("POST", "/login", true);
xhttp.send(<password>);
});