Force / respect password requirements set in site configuration when suggesting passwords

This commit is contained in:
nathan 2022-12-06 14:32:14 -07:00
parent 75115d96a9
commit 8764d51701

View File

@ -125,7 +125,9 @@ class Password extends Etemplate\Widget\Textbox
*/
public static function ajax_suggest($size = 12)
{
$password = Auth::randomstring($size, false);
$config = Api\Config::read('phpgwapi');
$size = max(min((int)$size, (int)$config['force_pwd_length']), 6);
$password = Auth::randomstring($size, $config['force_pwd_strength'] == 4);
$response = \EGroupware\Api\Json\Response::get();
$response->data($password);