def remove_pass(): if ("pass" in session and "user" in session) and check_password( session["pass"], bdd.get_user_password_hash(cursor_bdd, session["user"])): try: id = request.args.get("id") bdd.delete_password(cursor_bdd, connexion_bdd, id) except: pass return redirect("/")
def test_password(): assert check_password("iloveyou") == "Horrible password" assert check_password("lol :)wsajdiloveyou435287") == "Moderate password" assert check_password("LOL :)wsajdiloveyou435287") == "Strong password" assert check_password( "QWERTYUIOPL,MNBVCXZASDFGHJK12345") == "Moderate password" assert check_password( "QWERTYUIOPL,MNBVCXZASDFGHJK12345abc") == "Strong password" assert check_password("9-0-'/.;]..[") == "Moderate password" assert check_password("9-0-[") == "Poor password" assert check_password("------*^%&$#^%@#*[") == "Poor password"
def valid_login(): global error password = request.form.get("password") user_name = request.form.get("name") hash_ = bdd.get_user_password_hash(cursor_bdd, user_name) if (check_password(password, hash_)): session["pass"] = password session["user"] = user_name return redirect("/") else: error = True return redirect("/login")
def test_strong(): assert check_password("UNSWIsTheBest2021") == "Strong password"
def test_symbol(): assert check_password("!@#$") == "Poor password"
def test_horrible(): assert check_password("iloveyou") == "Horrible password" assert check_password("123456") == "Horrible password" assert check_password("password") == "Horrible password"
def test_poor(): assert check_password("qwer") == "Poor password" assert check_password("iksn") == "Poor password" assert check_password("abc") == "Poor password"
def test_moderate(): assert check_password("goodweather1") == "Moderate password"
def check_password(self, raw_password): return password.check_password(raw_password, self.password)
def test_password_strong(): assert check_password("IAm7YearsOld") == "Strong password" assert check_password("ThisPasswordIsSTR0nk") == "Strong password" assert check_password("itugsghsgh;G9") == "Strong password" assert check_password("password") != "Strong password"
def test_password_moderate(): assert check_password("12345678") == "Moderate password" assert check_password("Iam1yearold") == "Moderate password" assert check_password("atleast8charactesr") == "Moderate password" assert check_password("Iam5yearsold") != "Moderate password"
def test_password_poor(): assert check_password("lidfudughlsifgbsidl") == "Poor password" assert check_password("thisIsAGreatPasswordIMO") == "Poor password" assert check_password("HelloWorld") == "Poor password" assert check_password("YourMum1") != "Poor password"
# mud.send_message(id, "<f220>What is going to be your name?") # Set eAttribute0 to 1000, signifying this client has initialised a player creation process. players[id]['exAttribute0'] = 1000 elif players[id]['name'] is not None \ and players[id]['authenticated'] is None: pl = loadPlayer(players[id]['name'], playersDB) #print(pl) dbPass = pl['pwd'] # Iterate through players in game and see if our newly connected players is not already in game. playerFound = False for pl in players: if players[id]['name'] != None and players[pl]['name'] != None and players[id]['name'] == players[pl]['name'] and pl != id: playerFound = True if check_password(dbPass, command): if playerFound == False: players[id]['authenticated'] = True players[id]['prefix'] = "None" players[id]['room'] = dbResponse[1] players[id]['lvl'] = dbResponse[2] players[id]['exp'] = dbResponse[3] players[id]['str'] = dbResponse[4] players[id]['per'] = dbResponse[5] players[id]['endu'] = dbResponse[6] players[id]['cha'] = dbResponse[7] players[id]['int'] = dbResponse[8] players[id]['agi'] = dbResponse[9] players[id]['luc'] = dbResponse[10] players[id]['cred'] = dbResponse[11] players[id]['inv'] = dbResponse[12]#.split(',')