Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

101
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda