function uc_ups_admin_settings_validate in Ubercart 5
Same name and namespace in other branches
- 6.2 shipping/uc_ups/uc_ups.admin.inc \uc_ups_admin_settings_validate()
- 7.3 shipping/uc_ups/uc_ups.admin.inc \uc_ups_admin_settings_validate()
Validation handler for uc_ups_admin_settings.
Require password only if it hasn't been set.
File
- shipping/uc_ups/ uc_ups.module, line 364 
- Shipping quote module that interfaces with www.ups.com to get rates for small package shipments.
Code
function uc_ups_admin_settings_validate($form_id, $form_values, $form) {
  $old_password = variable_get('uc_ups_password', '');
  if (!$form_values['uc_ups_password']) {
    if ($old_password) {
      form_set_value($form['uc_ups_password'], $old_password);
    }
    else {
      form_set_error('uc_ups_password', t('Password field is required.'));
    }
  }
}