Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

98
Vistas
I want to keep the user information during user registration even after reloading

Sorry, this is not a code question.

I'm currently working on a web application using React.

I've been using Redux to manage user registration information (ex: email address, etc.) for user registration over several pages, but I noticed that the registered information disappears after reloading.

I thought about saving the information to localStorage, but gave up due to the security risk.

How would you guys keep your users' registration information?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

If the information is not much, you could use encrypted cookie data, and read back the data on page load.

  1. Create a .env file in your project root folder
  2. Save your pass access in this file like so REACT_APP_PASS=8604460484466
  3. use a function like
    const encryptWithAES = (text, pass) => {
      const passphrase = pass;
      return CryptoJS.AES.encrypt(text, passphrase).toString();
    }; // remember to import CryptoJS
  1. When the page loads you can read the data with:
    export const decryptWithAES = (ciphertext, pass) => {
      const passphrase = pass;
      const bytes = CryptoJS.AES.decrypt(ciphertext, passphrase);
      const originalText = bytes.toString(CryptoJS.enc.Utf8);
      return originalText;
    };
  1. When you want to store the cookie, then you can do it like so:
const tobeStored = encryptWithAES('text to encrypt', process.env.REACT_APP_PASS);
// then store it in your cookie.
  1. When you want to retrieve it:
const cookieData = someGetCookieFunction('UserInfo');
const decrypted  = decryptWithAES(cookieData,process.env.REACT_APP_PASS); 
  1. I am assuming that you know how to read cookie from your script.

See more information here and Here As well on how to set and call environment variables.

about 4 years ago · Juan Pablo Isaza Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda