Class: Redmine::SudoMode::Form

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/redmine/sudo_mode.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(password = nil) ⇒ Form

Returns a new instance of Form



17
18
19
# File 'lib/redmine/sudo_mode.rb', line 17

def initialize(password = nil)
  self.password = password
end

Instance Attribute Details

#original_fieldsObject

Returns the value of attribute original_fields



14
15
16
# File 'lib/redmine/sudo_mode.rb', line 14

def original_fields
  @original_fields
end

#passwordObject

Returns the value of attribute password



14
15
16
# File 'lib/redmine/sudo_mode.rb', line 14

def password
  @password
end

Instance Method Details

#check_passwordObject



21
22
23
24
25
# File 'lib/redmine/sudo_mode.rb', line 21

def check_password
  unless password.present? && User.current.check_password?(password)
    errors[:password] << :invalid
  end
end