Fixes bug related to password complexity limits

In some cases the randomly generated password can not fulfill the
complexity requirements. This patch adds a retry in case of failure with
a maximum limit suitable from a practical standpoint.