django-restit 4.2.64__py3-none-any.whl → 4.2.66__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/group.py +6 -0
- account/models/member.py +17 -7
- account/passkeys/core.py +1 -1
- account/rpc/auth.py +3 -1
- {django_restit-4.2.64.dist-info → django_restit-4.2.66.dist-info}/METADATA +1 -1
- {django_restit-4.2.64.dist-info → django_restit-4.2.66.dist-info}/RECORD +10 -10
- rest/__init__.py +1 -1
- rest/serializers/response.py +2 -1
- {django_restit-4.2.64.dist-info → django_restit-4.2.66.dist-info}/LICENSE.md +0 -0
- {django_restit-4.2.64.dist-info → django_restit-4.2.66.dist-info}/WHEEL +0 -0
account/models/group.py
CHANGED
@@ -200,6 +200,12 @@ class Group(models.Model, RestModel, MetaDataModel):
|
|
200
200
|
self.auditLog(note, "group_edit", level=21)
|
201
201
|
self.logEvent("group_edit", component="account.Member", component_id=request.member.id, note=note)
|
202
202
|
|
203
|
+
def set_name(self, value):
|
204
|
+
if value is not None:
|
205
|
+
self.name = value.strip()
|
206
|
+
else:
|
207
|
+
self.name = None
|
208
|
+
|
203
209
|
def set_child_of(self, value):
|
204
210
|
# this is a helper to add this group to another group
|
205
211
|
parent = Group.objects.filter(pk=value).last()
|
account/models/member.py
CHANGED
@@ -284,13 +284,12 @@ class Member(User, RestModel, MetaDataModel):
|
|
284
284
|
# can force login
|
285
285
|
if not request:
|
286
286
|
request = rh.getActiveRequest()
|
287
|
-
if password:
|
288
|
-
|
289
|
-
|
290
|
-
|
291
|
-
|
292
|
-
|
293
|
-
self.recordSuccessLogin(request)
|
287
|
+
if not self.checkPassword(password):
|
288
|
+
# invalid password
|
289
|
+
self.recordFailedLogin(request)
|
290
|
+
return False
|
291
|
+
else:
|
292
|
+
self.recordSuccessLogin(request)
|
294
293
|
if use_jwt:
|
295
294
|
self.recordSuccessLogin(request)
|
296
295
|
self.locateByIP(request.ip)
|
@@ -300,6 +299,17 @@ class Member(User, RestModel, MetaDataModel):
|
|
300
299
|
self.locateByIP(request.ip)
|
301
300
|
return True
|
302
301
|
|
302
|
+
def loginNoPassword(self, request=None):
|
303
|
+
if not self.is_active or self.is_blocked:
|
304
|
+
return False
|
305
|
+
# can force login
|
306
|
+
if not request:
|
307
|
+
request = rh.getActiveRequest()
|
308
|
+
self.user_ptr.backend = 'django.contrib.auth.backends.ModelBackend'
|
309
|
+
auth_login(request, self.user_ptr)
|
310
|
+
self.locateByIP(request.ip)
|
311
|
+
return True
|
312
|
+
|
303
313
|
def canLogin(self, request=None, throw_exception=True):
|
304
314
|
if not self.is_active:
|
305
315
|
self.log("login_blocked", F"account is not active {self.username}", request, method="login", level=31)
|
account/passkeys/core.py
CHANGED
@@ -115,7 +115,7 @@ def authComplete(request, fido2_state, rp_id):
|
|
115
115
|
response=credential)
|
116
116
|
request.member = upk.member
|
117
117
|
request.member.canLogin(request) # throws exception if cannot login
|
118
|
-
request.member.
|
118
|
+
request.member.loginNoPassword(request=request)
|
119
119
|
request.member.log(
|
120
120
|
"passkey_login", "passkey login succesful",
|
121
121
|
request, method="login", level=7)
|
account/rpc/auth.py
CHANGED
@@ -37,6 +37,9 @@ def jwt_login(request):
|
|
37
37
|
member = getMemberByUsername(username)
|
38
38
|
if not member:
|
39
39
|
return rv.restPermissionDenied(request, error=f"Password and/or Username is incorrect for {username}", error_code=422)
|
40
|
+
auth_code = request.DATA.get(["auth_code", "code", "invite_token"], None)
|
41
|
+
if username and auth_code:
|
42
|
+
return member_login_uname_code(request, username, auth_code)
|
40
43
|
password = request.DATA.get('password', None)
|
41
44
|
member.canLogin(request) # throws exception if cannot login
|
42
45
|
if member.requires_totp or member.has_totp:
|
@@ -205,7 +208,6 @@ def member_login_uname_code(request, username, auth_code):
|
|
205
208
|
member.log("code_login", "code login", request, method="login", level=8)
|
206
209
|
if request.DATA.get("auth_method") == "basic":
|
207
210
|
return rv.restGet(request, dict(id=member.pk, session_key=request.session.session_key))
|
208
|
-
|
209
211
|
return on_complete_jwt(request, member)
|
210
212
|
|
211
213
|
|
@@ -26,9 +26,9 @@ account/migrations/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuF
|
|
26
26
|
account/models/__init__.py,sha256=cV_lMnT2vL_mjiYtT4hlcIHo52ocFbGSNVkOIHHLXZY,385
|
27
27
|
account/models/device.py,sha256=MVWZEYrX_4zJaqmJS_feFplfVXYyqBJ-0_Fm3B1SVg8,5226
|
28
28
|
account/models/feeds.py,sha256=vI7fG4ASY1M0Zjke24RdnfDcuWeATl_yR_25jPmT64g,2011
|
29
|
-
account/models/group.py,sha256=
|
29
|
+
account/models/group.py,sha256=my4KT71BlS64d-Ozz9n6d57nH429kFpVdJQZZTlMqhs,21723
|
30
30
|
account/models/legacy.py,sha256=zYdtv4LC0ooxPVqWM-uToPwV-lYWQLorSE6p6yn1xDw,2720
|
31
|
-
account/models/member.py,sha256=
|
31
|
+
account/models/member.py,sha256=uantXINX1lHcJPnQJ6nSddgxIvpvYgQtl0qKqWApzNc,50742
|
32
32
|
account/models/membership.py,sha256=GJ6bSFLfU1CN9466k0XjSwn1sQIEwFeC8-oUYd2MrSs,9217
|
33
33
|
account/models/notify.py,sha256=YnZujSHJHY7B09e6FIyZIEJRWLPYk1Sk1e92tFzB1IA,12078
|
34
34
|
account/models/passkeys.py,sha256=TJxITUi4DT4_1tW2K7ZlOcRjJuMVl2NtKz7pKQU8-Tw,1516
|
@@ -37,10 +37,10 @@ account/models/settings.py,sha256=gOyRWBVd3BQpjfj_hJPtqX3H46ztyRAFxBrPbv11lQg,21
|
|
37
37
|
account/oauth/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
38
38
|
account/oauth/google.py,sha256=q5M6Qhpfp9QslKRVYFZBvtG6kgXV6vYMrR5fp6Xdb9I,2078
|
39
39
|
account/passkeys/__init__.py,sha256=FwXYJXwSJXfkLojGBcVpF1dFpgFhzDdd9N_3naYQ0cc,89
|
40
|
-
account/passkeys/core.py,sha256=
|
40
|
+
account/passkeys/core.py,sha256=xj-vXjSrfWDvc5MYtEmXzwaMkNHl-cXrQKVrN9soRCg,4126
|
41
41
|
account/periodic.py,sha256=-u0n-7QTJgDOkasGhBAPwHAwjpqWGA-MZLEFkVTqCGU,874
|
42
42
|
account/rpc/__init__.py,sha256=SGF0M_-H0dKh3b1apSX29BotNWAvITYccGQVC0MIjL8,336
|
43
|
-
account/rpc/auth.py,sha256=
|
43
|
+
account/rpc/auth.py,sha256=Vrg8j_bb5jeIahIMlEm86LTKBi-pCKBagpTC4EcN8i0,15770
|
44
44
|
account/rpc/device.py,sha256=fbbZFp3cUdhVXvD7gVFOqFWj4hKS3bjZKD_aF5fQxd8,2852
|
45
45
|
account/rpc/group.py,sha256=FD9GymgPY68y-gtDLsZxYVdwQJeLGpqcP4hjcDUh-GM,4022
|
46
46
|
account/rpc/member.py,sha256=PU-Uz5KUI_BZFy-F-taDqAfnt_AwONYXSzUvfm7eyTw,1264
|
@@ -368,7 +368,7 @@ pushit/utils.py,sha256=IeTCGa-164nmB1jIsK1lu1O1QzUhS3BKfuXHGjCW-ck,2121
|
|
368
368
|
rest/.gitignore,sha256=TbEvWRMnAiajCTOdhiNrd9eeCAaIjRp9PRjE_VkMM5g,118
|
369
369
|
rest/README.md,sha256=V3ETc-cJu8PZIbKr9xSe_pA4JEUpC8Dhw4bQeVCDJPw,5460
|
370
370
|
rest/RemoteEvents.py,sha256=nL46U7AuxIrlw2JunphR1tsXyqi-ep_gD9CYGpYbNgE,72
|
371
|
-
rest/__init__.py,sha256=
|
371
|
+
rest/__init__.py,sha256=yUGGhaiZHnz8BlV-outvcNP7abr5Samxuo6VesvF84Y,121
|
372
372
|
rest/arc4.py,sha256=y644IbF1ec--e4cUJ3KEYsewTCITK0gmlwa5mJruFC0,1967
|
373
373
|
rest/cache.py,sha256=1Qg0rkaCJCaVP0-l5hZg2CIblTdeBSlj_0fP6vlKUpU,83
|
374
374
|
rest/crypto/__init__.py,sha256=Tl0U11rgj1eBYqd6OXJ2_XSdNLumW_JkBZnaJqI6Ldw,72
|
@@ -417,7 +417,7 @@ rest/serializers/legacy.py,sha256=a5O-x2PqMKX8wYWrhCmdcivVbkPnru7UdyLbrhCaAdY,61
|
|
417
417
|
rest/serializers/localizers.py,sha256=BegaCvTQVaruhWzvGHq3zWeVFmtBChatquRqAtkke10,410
|
418
418
|
rest/serializers/model.py,sha256=08HJeqpmytjxvyiJFfsSRRG0uH-iK2mXCw6w0oMfWrI,8598
|
419
419
|
rest/serializers/profiler.py,sha256=OxOimhEyvCAuzUBC9Q1dz2xaakjAqmSnekMATsjduXM,997
|
420
|
-
rest/serializers/response.py,sha256=
|
420
|
+
rest/serializers/response.py,sha256=hl5ruTWKML352Nob75uc3YGTplYmBu7OMjWeEWVEs9Y,7234
|
421
421
|
rest/serializers/util.py,sha256=-In89fpuVTd6_Ul8nwEUt3DjVKdpeoEyAxudlyB8K6Y,2734
|
422
422
|
rest/settings_helper.py,sha256=_Vn9nmL5_GPss9zIsXzacbTQkn99NbO42CqvOZC3ge4,1532
|
423
423
|
rest/ssl_check.py,sha256=kH4Pk4upUEwKTAnBLR0DIKezNJHjkW3g2TdQAObEgW4,1419
|
@@ -501,7 +501,7 @@ ws4redis/servers/uwsgi.py,sha256=VyhoCI1DnVFqBiJYHoxqn5Idlf6uJPHvfBKgkjs34mo,172
|
|
501
501
|
ws4redis/settings.py,sha256=K0yBiLUuY81iDM4Yr-k8hbvjn5VVHu5zQhmMK8Dtz0s,1536
|
502
502
|
ws4redis/utf8validator.py,sha256=S0OlfjeGRP75aO6CzZsF4oTjRQAgR17OWE9rgZdMBZA,5122
|
503
503
|
ws4redis/websocket.py,sha256=R0TUyPsoVRD7Y_oU7w2I6NL4fPwiz5Vl94-fUkZgLHA,14848
|
504
|
-
django_restit-4.2.
|
505
|
-
django_restit-4.2.
|
506
|
-
django_restit-4.2.
|
507
|
-
django_restit-4.2.
|
504
|
+
django_restit-4.2.66.dist-info/LICENSE.md,sha256=VHN4hhEeVOoFjtG-5fVv4jesA4SWi0Z-KgOzzN6a1ps,1068
|
505
|
+
django_restit-4.2.66.dist-info/METADATA,sha256=5QzuN2gDiDACp64YSSsI-0uCKbE1VuJev0fw64U1vrQ,7594
|
506
|
+
django_restit-4.2.66.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
|
507
|
+
django_restit-4.2.66.dist-info/RECORD,,
|
rest/__init__.py
CHANGED
rest/serializers/response.py
CHANGED
@@ -12,6 +12,7 @@ from . import json as js
|
|
12
12
|
from . import csv
|
13
13
|
from . import excel
|
14
14
|
# from . import profiler
|
15
|
+
STATUS_ON_PERM_DENIED = settings.get("STATUS_ON_PERM_DENIED", 403)
|
15
16
|
|
16
17
|
|
17
18
|
def restStatus(request, status, data={}, **kwargs):
|
@@ -94,7 +95,7 @@ def restResponseLog(request, resp):
|
|
94
95
|
PersistentLog.log(resp, 0, request, "rest", action="response")
|
95
96
|
|
96
97
|
|
97
|
-
def restPermissionDenied(request, error="permission denied", error_code=403, status=
|
98
|
+
def restPermissionDenied(request, error="permission denied", error_code=403, status=STATUS_ON_PERM_DENIED,
|
98
99
|
component=None, component_id=None):
|
99
100
|
# from rest import helpers as rh
|
100
101
|
# rh.log_error(error)
|
File without changes
|
File without changes
|