Module: ODDB::Html::Util::NeedAllInput

Included in:
State::Drugs::Feedback, State::RegisterExport, State::RegisterPowerUser
Defined in:
lib/oddb/html/util/need_all_input.rb

Instance Method Summary collapse

Instance Method Details

#user_input(keys, mandatory) ⇒ Object



8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/oddb/html/util/need_all_input.rb', line 8

def user_input(keys, mandatory)
  input = super
  pass1 = input[:pass]
  pass2 = input[:confirm_pass]
  unless(@user || pass1 == pass2)
    err1 = create_error(:e_non_matching_set_pass, :pass, pass1)
    err2 = create_error(:e_non_matching_set_pass, :confirm_pass, pass2)
    @errors.store(:pass, err1)
    @errors.store(:confirm_pass, err2)
  end
  msg = 'e_need_all_input'
  @errors.each { |key, err|
    if(err.message.match(/^e_missing_/))
      @errors.store(key, create_error(msg, key, err.value))
    end
  }
  input
end