Simple auto-login from emails using your favorite key-value store
danbirken.com
danbirken.com
Also your code has a bug: What if generate_random_string returns the same result twice? You don't check for that.
A 20 digit long code with a 26 digit set likely IS secure enough. But why not just add 0-9 for funzies? It won't break compatibility, and expands the scope quite nicely.