summaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-04 11:05:02 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-03-04 11:05:02 +0000
commitaf75583b23db2bc6848fa1131cf9f66f073c8549 (patch)
treef5667c3b633791122faaa9138c03ae52f34f3789 /app
parent8db9ffbd8bda68a98ac5896dc0d5f3bfba4c7b70 (diff)
downloadredmine-af75583b23db2bc6848fa1131cf9f66f073c8549.tar.gz
redmine-af75583b23db2bc6848fa1131cf9f66f073c8549.zip
Adds Redmine::Utils.random_hex for generating a random hex string.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9071 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app')
-rw-r--r--app/controllers/attachments_controller.rb2
-rw-r--r--app/models/mail_handler.rb4
-rw-r--r--app/models/token.rb2
-rw-r--r--app/models/user.rb2
4 files changed, 5 insertions, 5 deletions
diff --git a/app/controllers/attachments_controller.rb b/app/controllers/attachments_controller.rb
index 9d77993ab..37b256a94 100644
--- a/app/controllers/attachments_controller.rb
+++ b/app/controllers/attachments_controller.rb
@@ -69,7 +69,7 @@ class AttachmentsController < ApplicationController
@attachment = Attachment.new(:file => request.body)
@attachment.author = User.current
- @attachment.filename = ActiveSupport::SecureRandom.hex(16)
+ @attachment.filename = Redmine::Utils.random_hex(16)
if @attachment.save
respond_to do |format|
diff --git a/app/models/mail_handler.rb b/app/models/mail_handler.rb
index 9c9665183..2d50a8057 100644
--- a/app/models/mail_handler.rb
+++ b/app/models/mail_handler.rb
@@ -367,11 +367,11 @@ class MailHandler < ActionMailer::Base
user.lastname = '-' if user.lastname.blank?
password_length = [Setting.password_min_length.to_i, 10].max
- user.password = ActiveSupport::SecureRandom.hex(password_length / 2 + 1)
+ user.password = Redmine::Utils.random_hex(password_length / 2 + 1)
user.language = Setting.default_language
unless user.valid?
- user.login = "user#{ActiveSupport::SecureRandom.hex(6)}" unless user.errors[:login].blank?
+ user.login = "user#{Redmine::Utils.random_hex(6)}" unless user.errors[:login].blank?
user.firstname = "-" unless user.errors[:firstname].blank?
user.lastname = "-" unless user.errors[:lastname].blank?
end
diff --git a/app/models/token.rb b/app/models/token.rb
index 89d1352ee..c6425f0fa 100644
--- a/app/models/token.rb
+++ b/app/models/token.rb
@@ -39,7 +39,7 @@ class Token < ActiveRecord::Base
private
def self.generate_token_value
- ActiveSupport::SecureRandom.hex(20)
+ Redmine::Utils.random_hex(20)
end
# Removes obsolete tokens (same user and action)
diff --git a/app/models/user.rb b/app/models/user.rb
index 15cdce1b2..a37c4dffa 100644
--- a/app/models/user.rb
+++ b/app/models/user.rb
@@ -610,7 +610,7 @@ class User < Principal
# Returns a 128bits random salt as a hex string (32 chars long)
def self.generate_salt
- ActiveSupport::SecureRandom.hex(16)
+ Redmine::Utils.random_hex(16)
end
end