Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

97
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!