File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -19,14 +19,15 @@ async def get_password(
1919 def password_hint (value : str ) -> InputInfo | None :
2020 if not value :
2121 return None
22+
2223 strength = PasswordStrength .strength (value )
23- if strength in ( PasswordStrength . VERY_WEAK , PasswordStrength . WEAK ) :
24- return InputInfo ( message = tr ( 'Password strength: Weak' ), msg_level = MsgLevelType . MsgError )
25- elif strength == PasswordStrength . MODERATE :
26- return InputInfo ( message = tr ( 'Password strength: Moderate' ), msg_level = MsgLevelType . MsgWarning )
27- elif strength == PasswordStrength . STRONG :
28- return InputInfo ( message = tr ( 'Password strength: Strong' ), msg_level = MsgLevelType . MsgInfo )
29- return None
24+ match strength :
25+ case PasswordStrength . VERY_WEAK | PasswordStrength . WEAK :
26+ return InputInfo ( message = tr ( 'Password strength: Weak' ), msg_level = MsgLevelType . MsgError )
27+ case PasswordStrength . MODERATE :
28+ return InputInfo ( message = tr ( 'Password strength: Moderate' ), msg_level = MsgLevelType . MsgWarning )
29+ case PasswordStrength . STRONG :
30+ return InputInfo ( message = tr ( 'Password strength: Strong' ), msg_level = MsgLevelType . MsgInfo )
3031
3132 while True :
3233 result = await Input (
You can’t perform that action at this time.
0 commit comments