def new_user(self): while True: user=ui.query(u'enter username:'******'text') if not user: return 0 user=user.lower() if os.path.exists(folder+'%s.gpd'%user): ui.note(u'username already exists', 'error') else: break while True: passw=ui.multi_query(u'enter password', u'retype password') if not passw: return 0 if passw[0]!=passw[1]: ui.note(u'password mismatch', 'error') else: break new=open(folder+'%s.gpd'%user, 'w') data=('0', '0') for i in data: new.write(i+'\n') new.close() self.db[user]=passw[0] db=open(folder+'ini.db', 'w') db.write(str(self.db)) db.close() ui.note(u'Success', 'conf') return 1
def ch_pass(self, user): new=ui.multi_query(u'enter current password:'******'enter new password:'******'wrong password', 'error') return 0 else: self.db[user]=new[1] a=open(folder+'ini.db', 'w') a.write(str(self.db)) a.close() ui.note(u'success', 'conf') return 1
def prompt2(label1, label2): return appuifw.multi_query(unicode(label1), unicode(label2))