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.



34
35
36
# File 'lib/redmine/sudo_mode.rb', line 34

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

Instance Attribute Details

#original_fieldsObject

Returns the value of attribute original_fields.



31
32
33
# File 'lib/redmine/sudo_mode.rb', line 31

def original_fields
  @original_fields
end

#passwordObject

Returns the value of attribute password.



31
32
33
# File 'lib/redmine/sudo_mode.rb', line 31

def password
  @password
end

Instance Method Details

#check_passwordObject



38
39
40
41
42
# File 'lib/redmine/sudo_mode.rb', line 38

def check_password
  unless password.present? && User.current.check_password?(password)
    errors.add(:password, :invalid)
  end
end