Exemple #1
0
def is_login_exists(login):
    deserialized = deserialize_users()
    for d in deserialized:
        if d['login'] == login:
            return d['login']

    print("Brak użytkownika w systemie")
Exemple #2
0
def is_user_exist(login):
    users = deserialize_users()
    for user in users:
        if user['login'] == login:
            return True

    return False
Exemple #3
0
def is_correct_password(login):
    users = deserialize_users()
    pwd = input(
        "Hasło: ")  #tutaj powinno być getpass(), ale w pycharmie nie działa
    for user in users:
        if user['login'] == login:
            salt = user['passwordhashed'][:64]
            stored_password = user['passwordhashed'][64:]
            pwdhash = hashlib.pbkdf2_hmac('sha512', pwd.encode('utf-8'),
                                          salt.encode('ascii'), 100000)
            pwdhash = binascii.hexlify(pwdhash).decode('ascii')
            break

    if pwdhash == stored_password:
        return True

    return False
Exemple #4
0
def get_user(login):
    users = deserialize_users()
    for user in users:
        if user['login'] == login:
            return user
Exemple #5
0
 def __init__(self):
     self.state = 'hello_screen'
     self.users = deserialize_users()
     self.books = deserialize_books()