I need to provide store's clients with a tool to check the status of their repair orders.
The clients doesn't have a user or password. They are only a record in the database. Yet I need to give them a way to login to the webpage and check their status (ready or not). Forcing then to register is not an option.
I came with this idea:
- The user is asked for his email address
- The system check if this email is registered in the database, generates a hash and emails a special url with the hash.
- The user check's the email and go to this address
- When the system gets a request to the special address check if the hash is in the database and retrieves the user_id
- If it's present, voila! Hello John Doe Your order #3454364 is ready for pickup
The Hash generation algorithm would be.
SELECT clients set hash = SUBSTRING(PASSWORD(UUID()), 2);
The hash/password is salted and Bcrypt(ed) in the server.
I could add a timeout (hash valid for 1 day or something like that)
Is there something horribly wrong with this idea?
UPDATE: Corrected the wording so it's less confusing.
What work factor should I use for Bcrypt? It seems to be like the general idea is to increase the number until it takes ~1 second.
I like the output of MySQL's PASSWORD for the hash generation because it's very url friendly. But that's really the only reason. Any other suggestion?