fixing password generation according to password policy (MID-1889)