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.


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

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

Instance Attribute Details

#original_fieldsObject

Returns the value of attribute original_fields


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

def original_fields
  @original_fields
end

#passwordObject

Returns the value of attribute password


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

def password
  @password
end

Instance Method Details

#check_passwordObject


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

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