Skip to content

Commit

Permalink
fixed encrypting and migration
Browse files Browse the repository at this point in the history
  • Loading branch information
aderyabin committed Aug 14, 2011
1 parent 8d9a25d commit 1d3d19c
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lib/devise_autosigninable/model.rb
Expand Up @@ -82,7 +82,7 @@ def reset_all_autosignin_tokens(batch_size=500)

# generation random autosignin token
def autosignin_token
ActiveSupport::SecureRandom.hex(16)
Digest::SHA1.hexdigest(ActiveSupport::SecureRandom.hex(16))
end

# Authenticate a user based on authentication token.
Expand Down
2 changes: 1 addition & 1 deletion lib/devise_autosigninable/schema.rb
Expand Up @@ -2,6 +2,6 @@

# add to migration neccessary fields for autosignin
def autosigninable
apply_schema :autosignin_token, String
apply_schema :autosignin_token, String, :limit=>40
end
end
4 changes: 2 additions & 2 deletions test/rails_app/test/unit/user_test.rb
Expand Up @@ -92,8 +92,8 @@ def setup
assert_equal User.autosignin_token.class, String
end

test "class method length of generated signin hash should be 32" do
assert_equal User.autosignin_token.length, 32
test "class method length of generated signin hash should be 40" do
assert_equal User.autosignin_token.length, 40
end

test "autosignin_token should generate new values" do
Expand Down

0 comments on commit 1d3d19c

Please sign in to comment.