django-restit 4.2.16__py3-none-any.whl → 4.2.17__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- account/models/member.py +2 -0
- account/passkeys/core.py +2 -2
- {django_restit-4.2.16.dist-info → django_restit-4.2.17.dist-info}/METADATA +1 -1
- {django_restit-4.2.16.dist-info → django_restit-4.2.17.dist-info}/RECORD +10 -10
- rest/__init__.py +1 -1
- rest/helpers.py +7 -0
- rest/jwtoken.py +4 -2
- rest/models/base.py +2 -0
- {django_restit-4.2.16.dist-info → django_restit-4.2.17.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.16.dist-info → django_restit-4.2.17.dist-info}/WHEEL +0 -0
account/models/member.py
CHANGED
@@ -88,6 +88,7 @@ class Member(User, RestModel, MetaDataModel):
|
|
88
88
|
("perms", "properties|permissions.")]
|
89
89
|
QUERY_FIELDS_SPECIAL = {
|
90
90
|
"ip": "auth_sessions__ip",
|
91
|
+
"login_country": "auth_sessions__location__country"
|
91
92
|
}
|
92
93
|
UNIQUE_LOOKUP = ["username", "email"]
|
93
94
|
METADATA_FIELD_PROPERTIES = settings.USER_METADATA_PROPERTIES
|
@@ -474,6 +475,7 @@ class Member(User, RestModel, MetaDataModel):
|
|
474
475
|
|
475
476
|
def disable(self, by="system", reason="", notify=True):
|
476
477
|
self.is_active = False
|
478
|
+
self.security_token = None
|
477
479
|
self.save()
|
478
480
|
self.memberships.update(state=-25)
|
479
481
|
|
account/passkeys/core.py
CHANGED
@@ -7,6 +7,7 @@ try:
|
|
7
7
|
from fido2.server import Fido2Server
|
8
8
|
from fido2.utils import websafe_decode, websafe_encode
|
9
9
|
from fido2 import cbor
|
10
|
+
fido2.features.webauthn_json_mapping.enabled = True
|
10
11
|
except Exception:
|
11
12
|
pass
|
12
13
|
|
@@ -22,7 +23,6 @@ FIDO_KEY_ATTACHMENT = settings.get("FIDO_KEY_ATTACHMENT", "cross-platform")
|
|
22
23
|
|
23
24
|
FIDO_SERVER_ID = settings.get("FIDO_SERVER_ID", settings.SERVER_NAME)
|
24
25
|
FIDO_SERVER_NAME = settings.get("FIDO_SERVER_NAME", settings.SITE_LABEL)
|
25
|
-
fido2.features.webauthn_json_mapping.enabled = True
|
26
26
|
|
27
27
|
|
28
28
|
def verify_origin(id):
|
@@ -106,7 +106,7 @@ def authComplete(request, fido2_state, rp_id):
|
|
106
106
|
credential = request.DATA.get("credential")
|
107
107
|
upk = UserPassKey.objects.filter(uuid=credential.id, is_enabled=1).last()
|
108
108
|
if upk is None:
|
109
|
-
raise Exception(
|
109
|
+
raise Exception("PassKey not found on host.")
|
110
110
|
stored_credentials = [webauthn.AttestedCredentialData(websafe_decode(upk.token))]
|
111
111
|
server = getServer(request, rp_id)
|
112
112
|
cred = server.authenticate_complete(
|
@@ -24,7 +24,7 @@ account/models/device.py,sha256=XipNpByreGubB5-d4ZBOoIV5Xw14b2Btcgn6fXz8HAc,4105
|
|
24
24
|
account/models/feeds.py,sha256=4n4Mv8HjcXpUmMPWafHlsGbVQ1fDKdtblL1hp30sDrg,1437
|
25
25
|
account/models/group.py,sha256=aG4qxqvuIEztZuNx5zw4R2EAQw5z8jZ4UBBpt9R3h1w,20218
|
26
26
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
27
|
-
account/models/member.py,sha256=
|
27
|
+
account/models/member.py,sha256=Vv2z3QNzY201OvIRjo8tIPi4mv_T1YCuBfeRAhakRbg,49629
|
28
28
|
account/models/membership.py,sha256=Qmp0xQa_3ObB581L83gce69t9eSfyH-mZZuGqW3ueI8,7763
|
29
29
|
account/models/notify.py,sha256=YnZujSHJHY7B09e6FIyZIEJRWLPYk1Sk1e92tFzB1IA,12078
|
30
30
|
account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
|
@@ -33,7 +33,7 @@ account/models/settings.py,sha256=gOyRWBVd3BQpjfj_hJPtqX3H46ztyRAFxBrPbv11lQg,21
|
|
33
33
|
account/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
34
34
|
account/oauth/google.py,sha256=q5M6Qhpfp9QslKRVYFZBvtG6kgXV6vYMrR5fp6Xdb9I,2078
|
35
35
|
account/passkeys/__init__.py,sha256=FwXYJXwSJXfkLojGBcVpF1dFpgFhzDdd9N_3naYQ0cc,89
|
36
|
-
account/passkeys/core.py,sha256=
|
36
|
+
account/passkeys/core.py,sha256=X8y1TCXupZZV-GF10nuPVmdpN0qYuzKe03RnaDlepP4,4116
|
37
37
|
account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
|
38
38
|
account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
|
39
39
|
account/rpc/auth.py,sha256=hINQS6BC04tZS5G0A-XXn2zAWxjWnba0l3zKNKZUsJM,14934
|
@@ -358,7 +358,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
358
358
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
359
359
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
360
360
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
361
|
-
rest/__init__.py,sha256=
|
361
|
+
rest/__init__.py,sha256=iCDDA2gsIQ-HuEDv5Vhp2KFKS-VjymncBkOg3ZURSvA,121
|
362
362
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
363
363
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
364
364
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -373,9 +373,9 @@ rest/extra/__init__.py,sha256=YzmNsch5H5FFLkUK9mIAKyoRK_rJCA9HGb0kubp4h30,54
|
|
373
373
|
rest/extra/json_metadata.py,sha256=p_ffzmANmOFix_oC3voR6_NNTjcn7-T7aXcH-I4_Npg,1078
|
374
374
|
rest/fields.py,sha256=_v1TJVc6vyWlqmwFRJ6mtuR5Fo-lS0KcUhPWIrzKZUo,9719
|
375
375
|
rest/forms.py,sha256=66Wm5cdy8tKib_mGicjq_yd-gNVMFWRECnrDksnNnwU,6316
|
376
|
-
rest/helpers.py,sha256=
|
376
|
+
rest/helpers.py,sha256=3zYt3NVQosv7r0MWsxQHpWjMRQ9xk1P_wxqrVJIPwZc,28021
|
377
377
|
rest/joke.py,sha256=0PpKaX2iN7jlS62kgjfmmqkFBYLPURz15aQ8R7OJkJ8,260
|
378
|
-
rest/jwtoken.py,sha256=
|
378
|
+
rest/jwtoken.py,sha256=2BjRrnQSzm7ydHgYl6LIjfGW1YPmqjt-gDIo21O0WTk,2388
|
379
379
|
rest/log.py,sha256=hd1_4HBOS395sfXJIL6BTw9yekm1SLgBwYx_PdfIhKA,20930
|
380
380
|
rest/mail.py,sha256=O9x4ggr5pQjpjJP1zwV6sv5-2_JNTvU877GLih6ceBY,7737
|
381
381
|
rest/mailman.py,sha256=v5O1G5s3HiAKmz-J1z0uT6_q3xsONPpxVl9saEyQQ2I,9174
|
@@ -390,7 +390,7 @@ rest/middleware/request.py,sha256=JchRNy5L-bGd-7h-KFYekGRvREe2eCkZXKOYqIkP2hI,41
|
|
390
390
|
rest/middleware/session.py,sha256=zHSoQpIzRLmpqr_JvW406wzpvU3W3gDbm5JhtzLAMlE,10240
|
391
391
|
rest/middleware/session_store.py,sha256=1nSdeXK8PyuYgGgIufqrS6j6QpIrQ7zbMNT0ol75e6U,1901
|
392
392
|
rest/models/__init__.py,sha256=M8pvFDq-WCF-QcM58X7pMufYYe0aaQ3U0PwGe9TKbbY,130
|
393
|
-
rest/models/base.py,sha256=
|
393
|
+
rest/models/base.py,sha256=Os_qWTvFedZQddulSsSdebheLIg9EGiYOGijofscTxQ,66539
|
394
394
|
rest/models/cacher.py,sha256=eKz8TINVhWEqKhJGMsRkKZTtBUIv5rN3NHbZwOC56Uk,578
|
395
395
|
rest/models/metadata.py,sha256=ui0962oaWbYGIbkNs7oaUGKyaca9epsW2H-ywgyH7rg,12631
|
396
396
|
rest/net.py,sha256=LTF4ip-ur8C2G7NETVOg7ioACegBGo4sDJA18PfF5kQ,1691
|
@@ -490,7 +490,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
490
490
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
491
491
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
492
492
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
493
|
-
django_restit-4.2.
|
494
|
-
django_restit-4.2.
|
495
|
-
django_restit-4.2.
|
496
|
-
django_restit-4.2.
|
493
|
+
django_restit-4.2.17.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
494
|
+
django_restit-4.2.17.dist-info/METADATA,sha256=ip7XGy-01eL9WI3vHoccBRjfVumkF-oHlm5gdWUkrhA,7594
|
495
|
+
django_restit-4.2.17.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
496
|
+
django_restit-4.2.17.dist-info/RECORD,,
|
rest/__init__.py
CHANGED
rest/helpers.py
CHANGED
@@ -863,6 +863,13 @@ def getBlockedHosts():
|
|
863
863
|
return blocked
|
864
864
|
|
865
865
|
|
866
|
+
def toInteger(value):
|
867
|
+
if isinstance(value, str):
|
868
|
+
if "." in value:
|
869
|
+
return int(float(value))
|
870
|
+
return int(value)
|
871
|
+
|
872
|
+
|
866
873
|
def toString(value):
|
867
874
|
if isinstance(value, bytes):
|
868
875
|
value = value.decode()
|
rest/jwtoken.py
CHANGED
@@ -6,14 +6,16 @@ from rest import settings
|
|
6
6
|
|
7
7
|
|
8
8
|
JWT_EXP_1_DAY = 86400
|
9
|
+
JWT_EXP_2_DAY = 172800
|
9
10
|
JWT_EXP_7_DAY = 604800
|
10
11
|
JWT_EXP_30_MIN = 1800
|
11
12
|
JWT_KEY = settings.SECRET_KEY
|
12
|
-
|
13
|
+
JWT_EXPIRES = settings.get("JWT_EXPIRES", JWT_EXP_30_MIN)
|
14
|
+
JWT_REFRESH_EXPIRES = settings.get("JWT_REFRESH_EXPIRES", JWT_EXP_2_DAY)
|
13
15
|
|
14
16
|
|
15
17
|
class JWToken():
|
16
|
-
def __init__(self, token=None, user_id=None, key=JWT_KEY, device_id=None, alg="HS256", access_expires_in=
|
18
|
+
def __init__(self, token=None, user_id=None, key=JWT_KEY, device_id=None, alg="HS256", access_expires_in=JWT_EXPIRES, refresh_expires_in=JWT_REFRESH_EXPIRES):
|
17
19
|
# takes full JWT token header.payload.signature
|
18
20
|
self.token = token
|
19
21
|
self.key = key
|
rest/models/base.py
CHANGED
@@ -1573,6 +1573,8 @@ class RestModel(object):
|
|
1573
1573
|
ft = cls.get_field_type(fn)
|
1574
1574
|
if ft == "DateTimeField":
|
1575
1575
|
value = rh.parseDateTime(value)
|
1576
|
+
elif ft == "IntegerField":
|
1577
|
+
value = rh.toInteger(value)
|
1576
1578
|
q[key] = value
|
1577
1579
|
if bool(q):
|
1578
1580
|
# rh.debug("queryFromRequest", q, "default_filters:", request.default_rest_filters)
|
File without changes
|
File without changes
|