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",
|
"upgrade_guid" : "46cbad92-353e-4b28-9bee-83950991dad8",
|
||||||
"version" : "1.2.04",
|
"version" : "1.2.05",
|
||||||
"product_name" : "VDI Client",
|
"product_name" : "VDI Client",
|
||||||
"manufacturer" : "Josh Patten",
|
"manufacturer" : "Josh Patten",
|
||||||
"name" : "VDI Client",
|
"name" : "VDI Client",
|
||||||
|
@ -34,6 +34,8 @@ tls_verify = false
|
|||||||
#token_name = dvi
|
#token_name = dvi
|
||||||
# API Token Value
|
# API Token Value
|
||||||
#token_value = xxx-x-x-x-xxx
|
#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]
|
||||||
# Hosts are entered as `IP/FQDN = Port`
|
# Hosts are entered as `IP/FQDN = Port`
|
||||||
|
17
vdiclient.py
17
vdiclient.py
@ -41,6 +41,7 @@ class G:
|
|||||||
guest_type = 'both'
|
guest_type = 'both'
|
||||||
width = None
|
width = None
|
||||||
height = None
|
height = None
|
||||||
|
pwresetcmd = None
|
||||||
|
|
||||||
def loadconfig(config_location = None):
|
def loadconfig(config_location = None):
|
||||||
if config_location:
|
if config_location:
|
||||||
@ -117,11 +118,13 @@ def loadconfig(config_location = None):
|
|||||||
if 'tls_verify' in config['Authentication']:
|
if 'tls_verify' in config['Authentication']:
|
||||||
G.verify_ssl = config['Authentication'].getboolean('tls_verify')
|
G.verify_ssl = config['Authentication'].getboolean('tls_verify')
|
||||||
if 'user' in config['Authentication']:
|
if 'user' in config['Authentication']:
|
||||||
G.user = config['Authentication']['user']
|
G.user = config['Authentication']['user']
|
||||||
if 'token_name' in config['Authentication']:
|
if 'token_name' in config['Authentication']:
|
||||||
G.token_name = config['Authentication']['token_name']
|
G.token_name = config['Authentication']['token_name']
|
||||||
if 'token_value' in config['Authentication']:
|
if 'token_value' in config['Authentication']:
|
||||||
G.token_value = config['Authentication']['token_value']
|
G.token_value = config['Authentication']['token_value']
|
||||||
|
if 'pwresetcmd' in config['Authentication']:
|
||||||
|
G.pwresetcmd = config['Authentication']['pwresetcmd']
|
||||||
if not 'Hosts' in config:
|
if not 'Hosts' in config:
|
||||||
win_popup_button(f'Unable to read supplied configuration:\nNo `Hosts` section defined!', 'OK')
|
win_popup_button(f'Unable to read supplied configuration:\nNo `Hosts` section defined!', 'OK')
|
||||||
return False
|
return False
|
||||||
@ -180,6 +183,8 @@ def setmainlayout():
|
|||||||
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True)])
|
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True)])
|
||||||
else:
|
else:
|
||||||
layout.append([sg.Button("Log In", font=["Helvetica", 14], bind_return_key=True), sg.Button("Cancel", font=["Helvetica", 14])])
|
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
|
return layout
|
||||||
|
|
||||||
def getvms(listonly = False):
|
def getvms(listonly = False):
|
||||||
@ -483,6 +488,11 @@ def loginwindow():
|
|||||||
if event == 'Cancel' or event == sg.WIN_CLOSED:
|
if event == 'Cancel' or event == sg.WIN_CLOSED:
|
||||||
window.close()
|
window.close()
|
||||||
return False
|
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:
|
else:
|
||||||
if event in ('Log In', '\r', 'special 16777220', 'special 16777221'):
|
if event in ('Log In', '\r', 'special 16777220', 'special 16777221'):
|
||||||
popwin = win_popup("Please wait, authenticating...")
|
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')
|
win_popup_button('No desktop instances found, please consult with your system administrator', 'OK')
|
||||||
return False
|
return False
|
||||||
layout = setvmlayout(vms)
|
layout = setvmlayout(vms)
|
||||||
|
|
||||||
if G.icon:
|
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)
|
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:
|
else:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user