Use ActiveSupport::SecureRandom to generate tokens (#3351).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2740 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
e5ed2b0f73
commit
3e52383988
|
@ -36,9 +36,6 @@ class Token < ActiveRecord::Base
|
||||||
|
|
||||||
private
|
private
|
||||||
def self.generate_token_value
|
def self.generate_token_value
|
||||||
chars = ("a".."z").to_a + ("A".."Z").to_a + ("0".."9").to_a
|
ActiveSupport::SecureRandom.hex(20)
|
||||||
token_value = ''
|
|
||||||
40.times { |i| token_value << chars[rand(chars.size-1)] }
|
|
||||||
token_value
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue