]> source.dussan.org Git - redmine.git/commitdiff
Use ActiveSupport::SecureRandom to generate tokens (#3351).
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 13 May 2009 16:54:32 +0000 (16:54 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Wed, 13 May 2009 16:54:32 +0000 (16:54 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2740 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/models/token.rb

index 0e8c2c3e20cff2eb261c968cd3f0416098eb6f00..54e251a40af78f9a6bcdd6a36f4907d16b72a293 100644 (file)
@@ -36,9 +36,6 @@ class Token < ActiveRecord::Base
   
 private
   def self.generate_token_value
-    chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
-    token_value = ''
-    40.times { |i| token_value << chars[rand(chars.size-1)] }
-    token_value
+    ActiveSupport::SecureRandom.hex(20)
   end
 end