Merge "Increase password complexity"

This commit is contained in:
Zuul 2021-09-09 14:40:35 +00:00 committed by Gerrit Code Review
commit 07a66d1945
2 changed files with 5 additions and 3 deletions

View File

@ -492,9 +492,11 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
self.TLS_KEY_PATH)
self.kick_dashboard()
def _gen_user_password(self, length: int = 8) -> str:
def _gen_user_password(self, length: int = 12) -> str:
"""Generate a password"""
alphabet = string.ascii_letters + string.digits
alphabet = (
string.ascii_lowercase + string.ascii_uppercase + string.digits)
return ''.join(secrets.choice(alphabet) for i in range(length))
def _add_user_action(self, event: ActionEvent) -> None:

View File

@ -613,7 +613,7 @@ class TestCephDashboardCharmBase(CharmTestCase):
_choice.return_value = 'r'
self.assertEqual(
self.harness.charm._gen_user_password(),
'rrrrrrrr')
'rrrrrrrrrrrr')
@patch.object(charm.tempfile, 'NamedTemporaryFile')
@patch.object(charm.secrets, 'choice')