Adding hash support

This commit is contained in:
Fabian Stamm 2017-12-12 10:52:17 +01:00
parent cae29d263f
commit 586b804a05

View File

@ -1,7 +1,7 @@
from radicale.auth import BaseAuth from radicale.auth import BaseAuth
import urllib.request import urllib.request
import json import json
import hashlib
class Auth(BaseAuth): class Auth(BaseAuth):
def generate_base_uri(self, endpoint): def generate_base_uri(self, endpoint):
@ -14,7 +14,7 @@ class Auth(BaseAuth):
if user is None: if user is None:
return False return False
main_uri = self.generate_base_uri( main_uri = self.generate_base_uri(
"/client/check_pw") + "&uuid=" + user + "&password=" + password "/client/check_pw") + "&hashed=true&uuid=" + user + "&password=" + hashlib.sha512(password.encode()).hexdigest()
req = urllib.request.urlopen(main_uri, data=None) req = urllib.request.urlopen(main_uri, data=None)
jsons = req.read() jsons = req.read()
data = json.loads(jsons) data = json.loads(jsons)