Houdini/two_factor_authentication — pull request #35 by karolsarnacki (2014-05-22 16:32:58+00:00)
Title: Use Strings and not Symbols for keys when storing variable in warden session

I run into this problem after updating my application to Rails 4.1. The application stopped displaying 2FA screen even though the user had otp_secret_key set etc. After research, it occured that `warden.session(resource_name)[:need_two_factor_authentication]` always returned `false` regardless of the value we gave it elsewhere (see lib/two_factor_authentication/controllers/helpers.rb#15).

I think it is somehow related to this change: http://guides.rubyonrails.org/upgrading_ruby_on_rails.html#cookies-serializer (and the way that now all keys are stringified when you store cookie/session variable).

So, this happens after update to Rails 4.1:

````ruby
warden.session(resource_name)[:need_two_factor_authentication] = true
warden.session(resource_name)[:need_two_factor_authentication] # => nil
`````

BUT it can be easily remedied by using string keys for cookie/session variables:

````ruby
warden.session(resource_name)[:need_two_factor_authentication] = true
warden.session(resource_name)['need_two_factor_authentication'] # => true
````

and:

````ruby
warden.session(resource_name)['need_two_factor_authentication'] = true
warden.session(resource_name)['need_two_factor_authentication'] # => true
````

So, I think it's best to always store and read session variables using String keys (and not Symbol keys). If you look into Devise gem sources, they also use only String keys to read/write to warden session.