def requestCredentials(): from tkSimpleDialog import askstring from tkMessageBox import askyesno stillMore=askyesno('X02DA LogBook Interface','; '.join(globals()['benutzer'])+' have already been added, add another?') while stillMore: username=string.strip(askstring('Duo Information','DUO Username?')) password=string.strip(askstring('Duo Information','DUO Password?')) #groupid=tkSimpleDialog.askstring('Duo Information','DUO Group-Id?') #if groupid=='': groupid='0' if logbook.testConn(username,password,groupid)==0: globals()['benutzer'].append(username) globals()['passwort'].append(password) globals()['gruppeid'].append(groupid) globals()['_loginSchonGelesen']=1 _writeLogin(username,password,groupid) else: print 'Password Failed!' # insert dialog with current users and add another? stillMore=askyesno('X02DA LogBook Interface','; '.join(globals()['benutzer'])+' have already been added, add another?')
def _readLogin(): try: f=open(os.environ['HOME']+"/.tomcatlogbook","r") gString=' ' while len(gString)>0: gString=string.strip(f.readline()) try: gArr=gString.split(',') user=string.strip(gArr[0]) password=string.strip(gArr[1]) groupid=string.strip(gArr[2]) if logbook.testConn(user,password,groupid)==0: globals()['benutzer'].append(user) globals()['passwort'].append(password) globals()['gruppeid'].append(groupid) globals()['_loginSchonGelesen']=1 except: print gString+' not valid!' f.close() except: print 'Read Login Failed!'