Reputation: 613
I want to use the same domain site for login authentication in the system I'm currently creating.
I was able to confirm that the login information is correct using Ajax, and I'm using HTTPS communication. But no matter how much I use HTTPS, I don't want to send my password in plain text. I want to send it encrypted so that it can be compounded with .
The system that verifies your login information is .NET, so you have to be able to compound there.
I also don't know if it's common to encrypt passwords even when using HTTPS communication.
login.js
var app = new Vue({
el: "#app",
data: {
url: "https://********",
user: "",
password: ""
},
methods: {
login: function () {
//I want to encrypt it here.
axios.post(this.url, {
user: this.user,
password: this.password
})
.then(function (response) {
// alert('OK');
// alert(response);
console.log(response);
})
.catch(function (error) {
alert('NO');
// alert(error);
});
}
}
})
Upvotes: 1
Views: 165
Reputation: 35790
Elias's answer is the correct one here (I upvoted it). But just for anyone else who might find this question later based on its title, Javascript can do secure encryption.
If you're looking for that, I'd recommend the npm package "bcrypt", as it's sort of an industry standard for doing encryption in JS (eg. it's what you would use if you're following Elias's advice on an Express server, and want to hash your passwords).
Upvotes: 3
Reputation: 10254
There's no advantage in sending your password encrypted if you are already using HTTPS, the data will be well encrypted already. You will just add more overhead.
You might focus your concerns on how the server side handles the receives data:
Upvotes: 5