Add password reset command
This commit is contained in:
parent
3762af5d8c
commit
2bac614194
2
dist/vdiclient.json
vendored
2
dist/vdiclient.json
vendored
@ -1,6 +1,6 @@
|
||||
{
|
||||
"upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8",
|
||||
"version" : "1.2.04",
|
||||
"version" : "1.2.05",
|
||||
"product_name" : "VDI Client",
|
||||
"manufacturer" : "Josh Patten",
|
||||
"name" : "VDI Client",
|
||||
|
@ -34,6 +34,8 @@ tls_verify = false
|
||||
#token_name = dvi
|
||||
# API Token Value
|
||||
#token_value = xxx-x-x-x-xxx
|
||||
# Password Reset Command Launch. Has to be full executable Command
|
||||
#pwresetcmd = start chrome --app=http://pwreset.example.com
|
||||
|
||||
[Hosts]
|
||||
# Hosts are entered as `IP/FQDN = Port`
|
||||
|
11
vdiclient.py
11
vdiclient.py
@ -41,6 +41,7 @@ class G:
|
||||
guest_type = 'both'
|
||||
width = None
|
||||
height = None
|
||||
pwresetcmd = None
|
||||
|
||||
def loadconfig(config_location = None):
|
||||
if config_location:
|
||||
@ -122,6 +123,8 @@ def loadconfig(config_location = None):
|
||||
G.token_name = config['Authentication']['token_name']
|
||||
if 'token_value' in config['Authentication']:
|
||||
G.token_value = config['Authentication']['token_value']
|
||||
if 'pwresetcmd' in config['Authentication']:
|
||||
G.pwresetcmd = config['Authentication']['pwresetcmd']
|
||||
if not 'Hosts' in config:
|
||||
win_popup_button(f'Unable to read supplied configuration:\nNo `Hosts` section defined!', 'OK')
|
||||
return False
|
||||
@ -180,6 +183,8 @@ def setmainlayout():
|
||||
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True)])
|
||||
else:
|
||||
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True), sg.Button("Cancel", font=["Helvetica", 14])])
|
||||
if G.pwresetcmd:
|
||||
layout[-1].append(sg.Button('Password Reset', font=["Helvetica", 14]))
|
||||
return layout
|
||||
|
||||
def getvms(listonly = False):
|
||||
@ -483,6 +488,11 @@ def loginwindow():
|
||||
if event == 'Cancel' or event == sg.WIN_CLOSED:
|
||||
window.close()
|
||||
return False
|
||||
elif event == 'Password Reset':
|
||||
try:
|
||||
subprocess.check_call(G.pwresetcmd, shell=True)
|
||||
except Exception as e:
|
||||
win_popup_button(f'Unable to open password reset command.\n\nError Info:\n{e}', 'OK')
|
||||
else:
|
||||
if event in ('Log In', '\r', 'special 16777220', 'special 16777221'):
|
||||
popwin = win_popup("Please wait, authenticating...")
|
||||
@ -513,7 +523,6 @@ def showvms():
|
||||
win_popup_button('No desktop instances found, please consult with your system administrator', 'OK')
|
||||
return False
|
||||
layout = setvmlayout(vms)
|
||||
|
||||
if G.icon:
|
||||
window = sg.Window(G.title, layout, return_keyboard_events=True, finalize=True, resizable=False, no_titlebar=G.kiosk, size=(G.width, G.height), icon=G.icon)
|
||||
else:
|
||||
|
Loading…
x
Reference in New Issue
Block a user