Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

use ActiveSupport::SecureRandom instead of rand()

  • Loading branch information...
commit d624029a55f3edcf3a8c2d8ec2364d3df4b7be42 1 parent ea1ec87
Richard Taylor moomerman authored

Showing 1 changed file with 2 additions and 1 deletion. Show diff stats Hide diff stats

  1. +2 1  app/models/session.rb
3  app/models/session.rb
@@ -84,7 +84,8 @@ def assign_unique_key!
84 84
85 85 # Assigns a time-sensitive random validation key
86 86 def assign_unique_key
87   - self.unique_key = rand(10 ** 5).to_s.rjust(5,'0') # zero padded random 5 digits
  87 + # generate zero padded random 5 digits
  88 + self.unique_key = ActiveSupport::SecureRandom.random_number(10 **5).to_s.rjust(5,'0')
88 89 self.unique_key_generated_at = Time.now.utc
89 90 end
90 91 end

0 comments on commit d624029

Please sign in to comment.
Something went wrong with that request. Please try again.