<div>
            <div><span>What I used to do (before I started using auth_logic or device), was to have an auth_token column for each user, which contains a randomly generated value that's stored in the cookie along with the username or user ID. </span>The auth_token would be regenerated whenever a user changed their password, or clicked a "log out everywhere" link.</div><div><br></div><div><div><span>Personally I felt this was a safer approach as it didn't expose the password hash or salt, despite the fact that hash *should* be safe to expose.</span></div><div><span><br></span></div><div><span><br></span></div><div><span>-jim</span></div><div><span><br></span></div><div><span><br></span></div></div><div>
                <span>
                    <br>
                </span>
                <span></span>
                
                <p style="color: #a0a0a0;">On Monday, February 7, 2011 at 12:30, Andrew Stewart wrote:</p>
                <blockquote type="cite" style="border-left-style:solid;border-width:1px;margin-left:0px;padding-left:10px;">
                    <span><div><div>Hola El Rug,<br><br>I am wondering what I should store in a tamper-proof cookie to remember a user across browser sessions.  All I want to store is the user's id, much like this (Rails 3):<br><br>    cookies.signed[:remember_me] = user.id<br><br>However every example I have seen stores the user's id and their salt/password-hash.  I don't see, though, why we need the salt: the cookie is tamper-proof and the user's id isn't a secret.<br><br>According to this blog post it's so the cookie is invalidated when the user changes their password.<br><br>  <a href="http://m.onkey.org/signed-and-permanent-cookies-in-rails-3">http://m.onkey.org/signed-and-permanent-cookies-in-rails-3</a><br><br>Again, though, I don't see why we would want to invalidate the cookie in this situation.<br><br>Usually when I find myself saying, "Everybody else is wrong, it's just me that's right," I carry on happily.  However because this is authentication code I thought I should consult El Rug ;)<br><br>Thanks in advance,<br><br>Andy Stewart<br>-------<br><a href="http://airbladesoftware.com">http://airbladesoftware.com</a><br>_______________________________________________<br>Chat mailing list<br><a href="mailto:Chat@lists.lrug.org">Chat@lists.lrug.org</a><br><a href="http://lists.lrug.org/listinfo.cgi/chat-lrug.org">http://lists.lrug.org/listinfo.cgi/chat-lrug.org</a><br></div></div></span>
                
                
                
                
                </blockquote>
                
                <div>
                    <br>
                </div>
            </div>
        </div>