function logintoboggan_validate_pass in LoginToboggan 6
Same name and namespace in other branches
- 5 logintoboggan.module \logintoboggan_validate_pass()
- 7 logintoboggan.module \logintoboggan_validate_pass()
Modified version of user_validate_name
- validates user submitted passwords have a certain length and only contain letters, numbers or punctuation (graph character class in regex)
2 calls to logintoboggan_validate_pass()
- logintoboggan_user_edit_validate in ./
logintoboggan.module - Custom validation function for user edit form
- logintoboggan_user_register_validate in ./
logintoboggan.module - Custom validation function for user registration form
File
- ./
logintoboggan.module, line 889 - Logintoboggan Module
Code
function logintoboggan_validate_pass($pass) {
if (!strlen($pass)) {
return t('You must enter a password.');
}
if (preg_match('/[\\x{80}-\\x{A0}' . '\\x{A1}-\\x{F7}' . '\\x{AD}' . '\\x{2000}-\\x{200F}' . '\\x{2028}-\\x{202F}' . '\\x{205F}-\\x{206F}' . '\\x{FEFF}' . '\\x{FF01}-\\x{FF60}' . '\\x{FFF9}-\\x{FFFD}]/u', $pass)) {
return t('The password contains an illegal character.');
}
$min_pass_length = variable_get('logintoboggan_minimum_password_length', 0);
if ($min_pass_length && strlen($pass) < $min_pass_length) {
return t("The password is too short: it must be at least %min_length characters.", array(
'%min_length' => $min_pass_length,
));
}
}