Generate Hash into database item

Deployment

No row selected
No row selected
Tacioandrade     2 years ago

Hy, I'm developing my first application with Saltcorn to get to know the tool and I'm really enjoying it. I am currently encountering my first difficulty.

In my application, when I add an item to the database, it automatically generates a field like: [email protected], so that I can generate a temporary email for each user who registers in the system. For this, I used the String option in the temp-mail field and the "Calculated" option, but I have no idea how I can do it in the Formula to generate this.

I googled for Genarete Hash Saltcorn and found a method for generating passwords, but it didn't work: generate_password()+"@multiti.com.br"

Would anyone have an idea how to go about this? As a last resort, I thought of uploading a table with thousands of random emails generated via shell in Linux and ordering it to get it from the bank, but I found this option to be a great kludge.

Thanks in advance for the help.



No row selected
No row selected
Tacioandrade      2 years ago

I solve this problem using in Formula this code: Math.floor(Math.random() * 65536000)+"@cliente.com.br"

Is not the bast way to do this, but works. =)


No row selected
No row selected
Tacioandrade      2 years ago

Sory, dont works. With each insertion, the database changes this email. =(


No row selected
No row selected
      2 years ago

Problem solved select the options "Calculated" and "Stored" on the field creation.



Sign up to post a reply