I have a problem that is really easily solved with GUIDs.
In particular, for a password reset workflow, I would like to send a GUID token to a user's email and have them reset their password using the token. Since GUIDs are unique, this is pretty secure and saves me emailing people passwords, which is risky.
I noticed there is one uuid gem @ rubyforge but it looks quite old, and it writes stuff to the file system.
Does anyone know of any other gems that can create a globally unique identifier?
I know I can just fall back to:
(0..16).to_a.map{ |a| rand(16).to_s(16) }.join
But it does not really seem like a proper GUID ...
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…