How to send password to server using vue or javascript?

Viewed 5913

I have created vue components for login and registration. How do I send password to the server?? Should I just encrypt the password using bcrypt on the client side and then send it to Laravel or should I just send the plain password to Laravel and use bcrypt($request->get('password')); What would be a good option?

If I should encrypt the password in the vue component, what package/function should I use so that it will encrypt the password in the same way as Laravel/PHP does??

2 Answers

It is needed to encrypt password on client side!

  • Leaving user's password unencrypted means that it will be vulnerable to MITM attacks
  • SSL termination very often happens on load balancers, which means plaintext password travels from that point to your web server unprotected, where logging can be enabled by sysadmins, etc.
  • developers or sysadmins should NOT have possibility to get to user's passwords, which will happen if you will not encrypt password on client
Related