Need a help. how to generate 6 digit refer code

Like this you can try, just alters the code alone as per your requirement

Once user logged in successfully just use this block to generate a code and store it in tinydb or database… next time onwards just recall it

Or you can try this extension too