function genpass_user_admin_settings_validate in Generate Password 8
Same name and namespace in other branches
- 6 genpass.module \genpass_user_admin_settings_validate()
- 7 genpass.module \genpass_user_admin_settings_validate()
User settings validation.
1 string reference to 'genpass_user_admin_settings_validate'
- genpass_form_alter in ./
genpass.module - Implements hook_form_alter().
File
- ./
genpass.module, line 244 - Contains genpass.module.
Code
function genpass_user_admin_settings_validate($form, FormStateInterface &$form_state) {
// Validate length of password.
$length = $form_state
->getValue('genpass_length');
if (!is_numeric($length) || $length < 5 || $length > 32) {
$form_state
->setErrorByName('genpass_length', t('The length of a generated password must be between 5 and 32.'));
return;
}
return $form;
}