Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

use ActiveSupport::SecureRandom instead of rand()

  • Loading branch information...
commit d624029a55f3edcf3a8c2d8ec2364d3df4b7be42 1 parent ea1ec87
Richard Taylor moomerman authored
Showing with 2 additions and 1 deletion.
  1. +2 −1  app/models/session.rb
3  app/models/session.rb
View
@@ -84,7 +84,8 @@ def assign_unique_key!
# Assigns a time-sensitive random validation key
def assign_unique_key
- self.unique_key = rand(10 ** 5).to_s.rjust(5,'0') # zero padded random 5 digits
+ # generate zero padded random 5 digits
+ self.unique_key = ActiveSupport::SecureRandom.random_number(10 **5).to_s.rjust(5,'0')
self.unique_key_generated_at = Time.now.utc
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.