0
在这个登录表单中只能使用相同的'用户名'和'密码'!我希望它的工作,如果任何'用户名'从'密码'列表获得匹配str,那么它也必须工作..帮助.. !!!登录表单无法使用! python
self.usernamelist = ['aniruddh','firoz','ashish']
self.passwordlist = ['aniruddh','firoz','ashish']
self.connect(self.okbutton, SIGNAL("clicked()"),self.loginfunction)
def loginfunction(self):
usernamestatus = False
usernameindex = -1
passwordstatus = False
passwordindex = -1
for currentusername in range(len(self.usernamelist)):
if self.passwordlist[currentusername] == self.username.text():
usernamestatus = True
usernameindex = self.usernamelist.index(self.passwordlist[currentusername])
for currentpassword in range(len(self.passwordlist)):
if self.usernamelist[currentpassword] == self.password.text():
passwordstatus = True
passwordindex = self.passwordlist.index(self.usernamelist[currentpassword])
if usernamestatus == True and passwordstatus ==True and usernameindex: #== passwordindex:
self.hide()
w2 = chooseoption.Form1(self)
w2.show()
else:
self.msgBox = QMessageBox()
self.msgBox.setWindowTitle("Alert!")
self.msgBox.setWindowIcon(QtGui.QIcon('abcd.ico'))
self.msgBox.setText("Unauthorised User!!!")
self.msgBox.exec_()
的太感谢你了! –