From fd7675adf2623f733da525e9912f5ce52ff31c71 Mon Sep 17 00:00:00 2001 From: Toshi MARUYAMA Date: Sat, 19 Oct 2019 13:33:32 +0000 Subject: [PATCH] code cleanup: rubocop: fix Lint/IneffectiveAccessModifier in app/models/user.rb git-svn-id: http://svn.redmine.org/redmine/trunk@18779 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- .rubocop_todo.yml | 1 - app/models/user.rb | 17 ++++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/.rubocop_todo.yml b/.rubocop_todo.yml index 7d8d061fc..aac2911a9 100644 --- a/.rubocop_todo.yml +++ b/.rubocop_todo.yml @@ -393,7 +393,6 @@ Lint/IneffectiveAccessModifier: - 'app/models/attachment.rb' - 'app/models/issue.rb' - 'app/models/mail_handler.rb' - - 'app/models/user.rb' Lint/InterpolationCheck: Exclude: diff --git a/app/models/user.rb b/app/models/user.rb index a8a80678a..84832de39 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -903,14 +903,17 @@ class User < Principal WikiContent::Version.where(['author_id = ?', id]).update_all(['author_id = ?', substitute.id]) end - # Return password digest - def self.hash_password(clear_password) - Digest::SHA1.hexdigest(clear_password || "") - end + # Singleton class method is public + class << self + # Return password digest + def hash_password(clear_password) + Digest::SHA1.hexdigest(clear_password || "") + end - # Returns a 128bits random salt as a hex string (32 chars long) - def self.generate_salt - Redmine::Utils.random_hex(16) + # Returns a 128bits random salt as a hex string (32 chars long) + def generate_salt + Redmine::Utils.random_hex(16) + end end # Send a security notification to all admins if the user has gained/lost admin privileges