Allow skip on password confirmation (#4273)
This commit is contained in:
parent
e06dd6299f
commit
8d6c56ca2b
|
|
@ -501,7 +501,7 @@ class ArchConfigHandler:
|
|||
lambda p=prompt: get_password( # type: ignore[misc]
|
||||
header=p,
|
||||
allow_skip=False,
|
||||
skip_confirmation=True,
|
||||
no_confirmation=True,
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@ async def get_password(
|
|||
header: str | None = None,
|
||||
allow_skip: bool = False,
|
||||
preset: str | None = None,
|
||||
skip_confirmation: bool = False,
|
||||
no_confirmation: bool = False,
|
||||
) -> Password | None:
|
||||
def password_hint(value: str) -> InputInfo | None:
|
||||
if not value:
|
||||
|
|
@ -51,7 +51,7 @@ async def get_password(
|
|||
password = Password(plaintext=result.get_value())
|
||||
break
|
||||
|
||||
if skip_confirmation:
|
||||
if no_confirmation:
|
||||
return password
|
||||
|
||||
confirmation_header = f'{tr("Password")}: {password.hidden()}\n\n'
|
||||
|
|
@ -62,13 +62,16 @@ async def get_password(
|
|||
return tr('The password did not match, please try again')
|
||||
return None
|
||||
|
||||
_ = await Input(
|
||||
result = await Input(
|
||||
header=confirmation_header,
|
||||
allow_skip=False,
|
||||
allow_skip=allow_skip,
|
||||
password=True,
|
||||
validator_callback=_validate,
|
||||
).show()
|
||||
|
||||
if result.type_ == ResultType.Skip:
|
||||
return None
|
||||
|
||||
return password
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -45,7 +45,7 @@ class UserList(ListManager[User]):
|
|||
elif action == self._actions[1] and entry: # change password
|
||||
header = f'{tr("User")}: {entry.username}\n'
|
||||
header += tr('Enter new password')
|
||||
new_password = await get_password(header=header)
|
||||
new_password = await get_password(header=header, allow_skip=True)
|
||||
|
||||
if new_password:
|
||||
user = next(filter(lambda x: x == entry, data))
|
||||
|
|
|
|||
Loading…
Reference in New Issue