Having only briefly looked through the code, I'd guess that updating the role 
is causing the password hash to be recreated because the logic in the 
encrypt_password message doesn't appear to prevent that from happening. 

You could verify this by seeing if the hash in the DB changes between creation 
and role update. To prevent this, you could try wrapping that code in an 
"unless password.nil?" condition in that method.

(X-posting to SO, as well.)

Hope this helps,
BenOn Mar 14, 2015 3:09 PM, Sebastjan Hribar <sebastjan.hri...@gmail.com> wrote:
>
> Hi guys, 
>
> I've just posted a question on SO regarding the authentication system 
> I've setup in my camping app and I can't resolve the error by myself. I 
> don't think it's related to camping itself, but maybe to AR or something 
> else. 
>
> If anyone wants to have a look, here's the link: 
> http://stackoverflow.com/questions/29054151/authentication-fails-in-camping-web-app-after-attribute-update.
>  
>
> Direct link to my gist is here: 
> https://gist.github.com/sebastjan-hribar/38b5b640ffd29d96cc70. 
>
> The problem is that user authentication fails after user attribute has 
> been updated in the database. Prior to that, everything works fine. 
>
> thank you for your help, 
> regards 
> seba 
> _______________________________________________ 
> Camping-list mailing list 
> Camping-list@rubyforge.org 
> http://rubyforge.org/mailman/listinfo/camping-list 
_______________________________________________
Camping-list mailing list
Camping-list@rubyforge.org
http://rubyforge.org/mailman/listinfo/camping-list

Reply via email to