mirror of
https://github.com/openstreetmap/openstreetmap-website.git
synced 2025-08-16 17:07:06 +00:00
Use SecureRandom to generate user tokens
This commit is contained in:
11
lib/osm.rb
11
lib/osm.rb
@ -502,15 +502,8 @@ module OSM
|
||||
end
|
||||
|
||||
# Construct a random token of a given length
|
||||
def self.make_token(length = 30)
|
||||
chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"
|
||||
token = ""
|
||||
|
||||
length.times do
|
||||
token += chars[(rand * chars.length).to_i].chr
|
||||
end
|
||||
|
||||
token
|
||||
def self.make_token(length = 24)
|
||||
SecureRandom.urlsafe_base64(length)
|
||||
end
|
||||
|
||||
# Return an SQL fragment to select a given area of the globe
|
||||
|
Reference in New Issue
Block a user