Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to send password to server using vue or javascript?

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??

like image 576
Pritam Bohra Avatar asked Aug 11 '17 06:08

Pritam Bohra


People also ask

How do I toggle visibility password in Vue?

A showPassword flag controls whether or not the user is working with a type="text" or type="password" input control. Type in the password field and press the eye icon to show or hide the password.

What is promise Vuejs?

The Promise object is used for asynchronous computations. A Promise represents a value which may be available now, or in the future, or never. A callback is any executable code that is passed as an argument to other code, which is expected to call back (execute) the argument at a given time.


1 Answers

It is not really need to encrypt the password in your javascript code. It is more important to serve your PHP on a HTTPS server.

The data sending between browser and your web server will be encrypted by the SSL/TLS cert.

Here are some guides to setup a HTTPS enabled web server, I assume your php is hosted on NGINX or Apache with php-fpm or apache php modules.

With letsencrypt, it provides a free SSL/TLS cert for your web server to secure the communication between client browser and itself.

  • https://www.digitalocean.com/community/tutorials/how-to-secure-nginx-with-let-s-encrypt-on-ubuntu-16-04
  • https://www.digitalocean.com/community/tutorials/how-to-secure-apache-with-let-s-encrypt-on-ubuntu-16-04
like image 131
kkpoon Avatar answered Nov 15 '22 14:11

kkpoon