def changePassword(self, oldP, newP): if self.authenticated and hashing.hashTag(oldP) == self.words[ self.ind]: self.words[self.ind] = hashing.hashTag(newP) self.updateCSV() self.rereadCSV() else: print("ERROR: NOT AUTHENTICATED")
def addClient(self, user, pas, name="", stat="[]", restriction="[]", foodData="[]"): ''' This adds a client to the database, with a username, password, actual name, and any past stats. If the user is already in the database, it will print an error. ''' if user in self.users: print("ERROR: PICK ANOTHER NAME") return 0 self.users.append(user) self.names.append(name) self.words.append(hashing.hashTag(pas)) self.stats.append(stat) self.restrictions.append(restriction) self.profileImgs.append( F"https://picsum.photos/id/{len(self.users)}/200/300") self.theProfileImg = F"https://picsum.photos/id/{len(self.users)}/200/300" self.updateCSV() self.rereadCSV() return 1
def _open(name, name1): if name == "userchange": self.editUsername(name1) elif name == "namechange": self.editName(name1) elif name == "passwordchange": self.changePassword(self.words[self.ind], hashing.hashTag(name1)) return "1"
def _open(name, name1): if name == "userchange": self.editUsername(name1) elif name == "namechange": self.editName(name1) elif name == "passwordchange": self.changePassword(self.words[self.ind], hashing.hashTag(name1)) elif name == "signout": self.authenticated = False self.user = "" return "1"
def login(self, user, pas): ''' Given a username and password, tries to find it, then sets all the local variables to the user's data. ''' try: if hashing.hashTag(pas) == self.userToPass[user]: self.authenticated = True self.user = user self.ind = self.userToNum[self.user] self.userUsername = self.users[self.ind] self.userRealName = self.names[self.ind] self.userStat = eval(self.stats[self.ind]) self.restrict = eval(self.restrictions[self.ind]) # print(self.userStat) return True else: print("INVALID CREDENTIALS") return False except: print("INVALID CREDENTIALS")
def addClient(self, user, pas, name="", stat="[]", restriction="[]", foodData="[]"): ''' This adds a client to the database, with a username, password, actual name, and any past stats. If the user is already in the database, it will print an error. ''' if user in self.users: print("ERROR: PICK ANOTHER NAME") return self.users.append(user) self.names.append(name) self.words.append(hashing.hashTag(pas)) self.stats.append(stat) self.restrictions.append(restriction) self.foodData.append(foodData) self.updateCSV() self.rereadCSV()
# Super quick program to just hash Accounts.csv passwords that we just randomly put in. import pandas as pd import hashing newVersion = pd.read_csv("Accounts.csv") for i in range(len(newVersion)): newVersion["PASSWORDS"][i] = hashing.hashTag( newVersion["PASSWORDS"].copy(deep=True)[i]) newVersion.to_csv("Accounts.csv", index=False)