user settings fixes
This commit is contained in:
parent
e65e19e293
commit
a45c314bab
@ -74,9 +74,7 @@ class User:
|
|||||||
hashed_new_password = UtilityHelper.computeHash(new_password)
|
hashed_new_password = UtilityHelper.computeHash(new_password)
|
||||||
hashed_old_password = UtilityHelper.computeHash(old_password)
|
hashed_old_password = UtilityHelper.computeHash(old_password)
|
||||||
|
|
||||||
private_key_bytes = Signature.privateKeyToBytes(self.private_ser)
|
if self.db.changePassword(self.private_ser, hashed_old_password, hashed_new_password) == True:
|
||||||
|
|
||||||
if self.db.changePassword(private_key_bytes, hashed_old_password, hashed_new_password) == True:
|
|
||||||
print('Password updated')
|
print('Password updated')
|
||||||
else:
|
else:
|
||||||
print('Something went wrong while trying to update password..')
|
print('Something went wrong while trying to update password..')
|
||||||
@ -90,9 +88,8 @@ class User:
|
|||||||
print("Username already taken")
|
print("Username already taken")
|
||||||
return False
|
return False
|
||||||
|
|
||||||
private_key_bytes = Signature.privateKeyToBytes(self.private_ser)
|
if self.db.changeUsername(self.private_ser, new_username) == True:
|
||||||
|
self.username = new_username
|
||||||
if self.db.changeUsername(private_key_bytes, new_username) == True:
|
|
||||||
print('Username updated')
|
print('Username updated')
|
||||||
else:
|
else:
|
||||||
print('Something went wrong while trying to update username..')
|
print('Something went wrong while trying to update username..')
|
||||||
@ -113,9 +110,7 @@ class User:
|
|||||||
else:
|
else:
|
||||||
print('Invalid input')
|
print('Invalid input')
|
||||||
|
|
||||||
private_key_bytes = Signature.privateKeyToBytes(self.private_ser)
|
if self.db.deleteUser(self.private_ser) == True:
|
||||||
|
|
||||||
if self.db.deleteUser(private_key_bytes) == True:
|
|
||||||
print('Account deleted')
|
print('Account deleted')
|
||||||
self.logout()
|
self.logout()
|
||||||
return True
|
return True
|
||||||
@ -124,9 +119,8 @@ class User:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
def printAccountInfo(self):
|
def printAccountInfo(self):
|
||||||
private_ser, public_ser = Signature.keysToBytes(self.private_ser, self.public_ser)
|
|
||||||
print('Username: ' + self.username)
|
print('Username: ' + self.username)
|
||||||
print(public_ser)
|
print(self.public_ser)
|
||||||
print(private_ser)
|
print(self.private_ser)
|
||||||
|
|
||||||
|
|
||||||
|
@ -69,6 +69,8 @@ class DatabaseHelper:
|
|||||||
try:
|
try:
|
||||||
self.cursor.execute("UPDATE `users` SET `password` = ? WHERE (`private_key` = ? AND `password` = ?)", (password, user_privatekey, old_password,))
|
self.cursor.execute("UPDATE `users` SET `password` = ? WHERE (`private_key` = ? AND `password` = ?)", (password, user_privatekey, old_password,))
|
||||||
self.commit()
|
self.commit()
|
||||||
|
if self.cursor.rowcount < 1:
|
||||||
|
return False
|
||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user