def __init__(self, fd): templatePage.__init__(self) if not self.updMysql(): return try: user = fd.formdata.getvalue('user') password = fd.formdata.getvalue('password') newpassword = fd.formdata.getvalue('newpassword') retypepassword = fd.formdata.getvalue('retypepassword') except: user = '' if newpassword != retypepassword: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('The new passwords you just entered are inconsistent. Please try it again',color='black')) elif user and password and newpassword: try: encrypt_password = webqtlUtil.authUser(user,password,self.cursor)[3] if encrypt_password: self.cursor.execute("""update User set password=SHA(%s) where name=%s""",(newpassword,user)) result = HT.Blockquote(HT.Font('Change Result: ',color='green'),HT.Font('You have succesfully changed your password. You may continue to use WebQTL.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('You entered wrong user name or password. Please try it again.',color='black')) except: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User database is not ready yet. Try again later.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('No user name or password or new password was entered, Please try it again.',color='black')) result.__setattr__("class","subtitle") self.dict['title'] = 'Change Password Result' self.dict['body'] = HT.TD(result,colspan=2,height=200,width="100%",bgColor='#eeeeee')
def __init__(self, fd): templatePage.__init__(self, fd) if not self.updMysql(): return try: user = fd.formdata.getvalue('user').strip() password = fd.formdata.getvalue('password').strip() except: user = password = '' if user and password: try: if user == password: raise 'identError' privilege, id, account_name, encrypt_password, grpName = webqtlUtil.authUser(user, password, self.cursor) if encrypt_password: self.session_data_changed['user'] = user self.session_data_changed['privilege'] = privilege self.cursor.execute("""update User set user_ip=%s,lastlogin=Now() where name=%s""",(fd.remote_ip,user)) myPage = IndexPage.IndexPage(fd) self.dict['title'] = myPage.dict['title'] self.dict['body'] = myPage.dict['body'] self.dict['js1'] = myPage.dict['js1'] self.dict['js2'] = myPage.dict['js2'] return else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('You entered wrong user name or password. Please try it again.',color='black')) except 'identError': result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User name and password are the same, modify you password before login.',color='black')) except: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('User database is not ready yet. Try again later.',color='black')) else: result = HT.Blockquote(HT.Font('Error: ',color='red'),HT.Font('No user name or password was entered, Please try it again.',color='black')) result.__setattr__("class","subtitle") self.dict['title'] = 'User Login Result' self.dict['body'] = HT.TD(result,colspan=2,height=200,width="100%",bgColor='#eeeeee') LOGOUT = HT.Href(text = "Logout",Class="small", target="_blank",url=os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE) + "?FormID=userLogoff") self.dict['login'] = LOGOUT
def __init__(self, fd): templatePage.__init__(self, fd) if not self.openMysql(): return ifVerified = None ifVerified = fd.formdata.getvalue('ifVerified') if ifVerified != 'GN@UTHSC': user = fd.formdata.getvalue('user') password = fd.formdata.getvalue('password') privilege, user_id, userExist = webqtlUtil.authUser(user,password,self.cursor,encrypt = None)[:3] if userExist and webqtlConfig.USERDICT[privilege] >= webqtlConfig.USERDICT['admin']: ifVerified = True if not ifVerified: heading = "Error page" detail = ["You do not have privilege to change system configuration."] self.error(heading=heading,detail=detail) return else: TD_LR = HT.TD(height=200,width="100%", bgColor='#eeeeee') heading = "Please click button to make your selection" createUserAccountForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='createUserAccountForm', submit=HT.Input(type='hidden')) createUserAccountForm.append( HT.Input(type='button', name='', value='Manage User Accounts', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden',name='FormID',value='createUserAccount'), HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC') ) assignUserToDatasetForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='assignUserToDatasetForm', submit=HT.Input(type='hidden')) assignUserToDatasetForm.append( HT.Input(type='button', name='', value='Manage Confidential Datasets', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden',name='FormID',value='assignUserToDataset'), HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC') ) deletePhenotypeTraitForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='deletePhenotypeTraitForm', submit=HT.Input(type='hidden')) deletePhenotypeTraitForm.append( HT.Input(type='button', name='', value='Delete Phenotype Trait', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden',name='FormID',value='deletePhenotypeTrait'), HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC'), HT.Input(type='hidden',name='status',value='input') ) exportPhenotypeDatasetForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='exportPhenotypeDatasetForm', submit=HT.Input(type='hidden')) exportPhenotypeDatasetForm.append( HT.Input(type='button', name='', value='Export Phenotype Dataset', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden',name='FormID',value='exportPhenotypeDataset'), HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC'), HT.Input(type='hidden',name='status',value='input') ) updateGenotypeForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='updateGenotypeForm', submit=HT.Input(type='hidden')) updateGenotypeForm.append( HT.Input(type='button', name='', value='Update Genotype', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden',name='FormID',value='updGeno'), HT.Input(type='hidden',name='ifVerified',value='GN@UTHSC') ) editHeaderForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='editHeaderForm', submit=HT.Input(type='hidden')) editHeaderForm.append( HT.Input(type='button', name='', value='Edit Header', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden', name='FormID', value='editHeaderFooter'), HT.Input(type='hidden', name='hf', value='h'), ) editFooterForm = HT.Form(cgi= os.path.join(webqtlConfig.CGIDIR, webqtlConfig.SCRIPTFILE), enctype='multipart/form-data', name='editFooterForm', submit=HT.Input(type='hidden')) editFooterForm.append( HT.Input(type='button', name='', value='Edit Footer', Class="button", onClick="submitToNewWindow(this.form);"), HT.Input(type='hidden', name='FormID', value='editHeaderFooter'), HT.Input(type='hidden', name='hf', value='f'), ) TD_LR.append(heading, HT.P(),HT.P(), createUserAccountForm, HT.P(),HT.P(), assignUserToDatasetForm, HT.P(),HT.P(), deletePhenotypeTraitForm, HT.P(),HT.P(), exportPhenotypeDatasetForm, HT.P(),HT.P(), updateGenotypeForm, HT.P(),HT.P(), editHeaderForm, HT.P(),HT.P(), editFooterForm) self.dict['body'] = str(TD_LR) self.dict['title'] = 'Manager Main Page'