gettext('password.passwordweak'); $rules[] = $rcmail->gettext('password.passwordnoseq'); $rules[] = $rcmail->gettext('password.passwordnocommon'); return $rules; } /** * Password strength check * * @param string $passwd Password * * @return array Score (1 to 5) and Reason */ function check_strength($passwd) { if (!class_exists('ZxcvbnPhp\Zxcvbn')) { rcube::raise_error(array( 'code' => 600, 'file' => __FILE__, 'line' => __LINE__, 'message' => "Password plugin: Zxcvbn library not found." ), true, false); return; } $rcmail = rcmail::get_instance(); $zxcvbn = new ZxcvbnPhp\Zxcvbn(); $strength = $zxcvbn->passwordStrength($passwd); return array($strength['score'] + 1, $strength['feedback']['warning']); } }