Allow inputting fingerprint check
This commit is contained in:
parent
9687318b22
commit
d5c48ddb94
@ -154,6 +154,7 @@ class Password(Handler):
|
|||||||
self.line_edit = LineEdit(is_password=True)
|
self.line_edit = LineEdit(is_password=True)
|
||||||
|
|
||||||
def initialize(self) -> None:
|
def initialize(self) -> None:
|
||||||
|
self.cmd.set_cursor_shape('beam')
|
||||||
self.draw_screen()
|
self.draw_screen()
|
||||||
|
|
||||||
@Handler.atomic_update
|
@Handler.atomic_update
|
||||||
|
|||||||
@ -14,7 +14,7 @@ combine_as_imports = True
|
|||||||
multi_line_output = 5
|
multi_line_output = 5
|
||||||
|
|
||||||
[mypy]
|
[mypy]
|
||||||
files = kitty,kittens,glfw,*.py,docs/conf.py
|
files = kitty,kittens,glfw,*.py,docs/conf.py,shell-integration/ssh/askpass.py
|
||||||
no_implicit_optional = True
|
no_implicit_optional = True
|
||||||
sqlite_cache = True
|
sqlite_cache = True
|
||||||
cache_fine_grained = True
|
cache_fine_grained = True
|
||||||
|
|||||||
@ -10,11 +10,12 @@ from kitty.shm import SharedMemory
|
|||||||
|
|
||||||
msg = sys.argv[-1]
|
msg = sys.argv[-1]
|
||||||
prompt = os.environ.get('SSH_ASKPASS_PROMPT', '')
|
prompt = os.environ.get('SSH_ASKPASS_PROMPT', '')
|
||||||
is_confirm = prompt == 'confirm' or 'continue connecting' in msg
|
is_confirm = prompt == 'confirm'
|
||||||
|
is_fingerprint_check = '(yes/no/[fingerprint])' in msg
|
||||||
q = {
|
q = {
|
||||||
'message': msg,
|
'message': msg,
|
||||||
'type': 'confirm' if is_confirm else 'get_line',
|
'type': 'confirm' if is_confirm else 'get_line',
|
||||||
'is_password': True,
|
'is_password': not is_fingerprint_check,
|
||||||
}
|
}
|
||||||
|
|
||||||
data = json.dumps(q)
|
data = json.dumps(q)
|
||||||
@ -35,5 +36,10 @@ with SharedMemory(
|
|||||||
response = json.loads(shm.read_data_with_size())
|
response = json.loads(shm.read_data_with_size())
|
||||||
if is_confirm:
|
if is_confirm:
|
||||||
response = 'yes' if response else 'no'
|
response = 'yes' if response else 'no'
|
||||||
|
elif is_fingerprint_check:
|
||||||
|
if response.lower() in ('y', 'yes'):
|
||||||
|
response = 'yes'
|
||||||
|
if response.lower() in ('n', 'no'):
|
||||||
|
response = 'no'
|
||||||
if response:
|
if response:
|
||||||
print(response, flush=True)
|
print(response, flush=True)
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user