Merge "Increase password complexity"
This commit is contained in:
commit
07a66d1945
@ -492,9 +492,11 @@ class CephDashboardCharm(ops_openstack.core.OSBaseCharm):
|
|||||||
self.TLS_KEY_PATH)
|
self.TLS_KEY_PATH)
|
||||||
self.kick_dashboard()
|
self.kick_dashboard()
|
||||||
|
|
||||||
def _gen_user_password(self, length: int = 8) -> str:
|
def _gen_user_password(self, length: int = 12) -> str:
|
||||||
"""Generate a password"""
|
"""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))
|
return ''.join(secrets.choice(alphabet) for i in range(length))
|
||||||
|
|
||||||
def _add_user_action(self, event: ActionEvent) -> None:
|
def _add_user_action(self, event: ActionEvent) -> None:
|
||||||
|
@ -613,7 +613,7 @@ class TestCephDashboardCharmBase(CharmTestCase):
|
|||||||
_choice.return_value = 'r'
|
_choice.return_value = 'r'
|
||||||
self.assertEqual(
|
self.assertEqual(
|
||||||
self.harness.charm._gen_user_password(),
|
self.harness.charm._gen_user_password(),
|
||||||
'rrrrrrrr')
|
'rrrrrrrrrrrr')
|
||||||
|
|
||||||
@patch.object(charm.tempfile, 'NamedTemporaryFile')
|
@patch.object(charm.tempfile, 'NamedTemporaryFile')
|
||||||
@patch.object(charm.secrets, 'choice')
|
@patch.object(charm.secrets, 'choice')
|
||||||
|
Loading…
Reference in New Issue
Block a user