I want to set up auto-login by giving the user a link/key they can use like http://domain.com/4yT67rw. The last 7 digits are random and assigned to the user model.
Is it possible to do this with custom routing? I imagine it would have to be something like a regex to detect that it is a key and not a model name or error.
Would be great if I could do something like:
map.connect 'reg_ex_here', :controller => 'users', :action => 'key_redirect'
and then in the users controller:
def key_redirect
user = User.find_by_key(key)
redirect_to user_path(user)
end
Or probably some other easy way that I don't know about. ;)
Thanks