check password against MD5 for compatibility

This commit is contained in:
Matt Hamilton 2016-08-22 15:05:34 -07:00
parent d872c0a80f
commit d3a835bef6
2 changed files with 6 additions and 4 deletions

View File

@ -325,11 +325,11 @@ class SyncServerProtocol(JSONCommandProtocol):
return username, serverPassword, roomName, version
def _checkPassword(self, serverPassword):
if self._factory.password:
if self._factory.password_sha512 or self._factory.password_md5:
if not serverPassword:
self.dropWithError(getMessage("password-required-server-error"))
return False
if serverPassword != self._factory.password:
if serverPassword != self._factory.password_md5 and serverPassword != self._factory.password_sha512:
self.dropWithError(getMessage("wrong-password-server-error"))
return False
return True

View File

@ -17,8 +17,10 @@ class SyncFactory(Factory):
def __init__(self, password='', motdFilePath=None, isolateRooms=False, salt=None, disableReady=False):
print getMessage("welcome-server-notification").format(syncplay.version)
if password:
password = hashlib.sha512(password).hexdigest()
self.password = password
password_sha512 = hashlib.sha512(password).hexdigest()
password_md5 = hashlib.md5(password).hexdigest()
self.password_sha512 = password_sha512
self.password_md5 = password_md5
if salt is None:
salt = RandomStringGenerator.generate_server_salt()
print getMessage("no-salt-notification").format(salt)