Use random device IDs when logging in

This commit is contained in:
Tulir Asokan 2019-06-08 17:02:52 +03:00
parent d5e78db5cf
commit 86adf093f1

View File

@ -16,8 +16,10 @@
from typing import Dict, Tuple, NamedTuple, Optional from typing import Dict, Tuple, NamedTuple, Optional
from json import JSONDecodeError from json import JSONDecodeError
from http import HTTPStatus from http import HTTPStatus
import hmac
import hashlib import hashlib
import random
import string
import hmac
from aiohttp import web from aiohttp import web
from mautrix.api import HTTPAPI, Path, Method from mautrix.api import HTTPAPI, Path, Method
@ -114,7 +116,7 @@ async def login(request: web.Request) -> web.Response:
"user": username, "user": username,
}, },
"password": password, "password": password,
"device_id": "maubot", "device_id": f"maubot_{random.choices(string.ascii_uppercase + string.digits, k=8)}",
})) }))
except MatrixRequestError as e: except MatrixRequestError as e:
return web.json_response({ return web.json_response({