mirror of
https://github.com/jumpserver/jumpserver.git
synced 2025-08-31 06:46:24 +00:00
perf: passkey 只允许本地用户开启
This commit is contained in:
@@ -22,6 +22,8 @@ class PasskeyViewSet(AuthMixin, FlashMessageMixin, ModelViewSet):
|
||||
|
||||
@action(methods=['get', 'post'], detail=False, url_path='register')
|
||||
def register(self, request):
|
||||
if request.user.source != 'local':
|
||||
return JsonResponse({'error': _('Only register passkey for local user')}, status=400)
|
||||
if request.method == 'GET':
|
||||
register_data, state = register_begin(request)
|
||||
return JsonResponse(dict(register_data))
|
||||
|
@@ -7,3 +7,6 @@ class PasskeyAuthBackend(JMSModelBackend):
|
||||
@staticmethod
|
||||
def is_enabled():
|
||||
return settings.AUTH_PASSKEY
|
||||
|
||||
def user_can_authenticate(self, user):
|
||||
return user.source == 'local'
|
||||
|
Reference in New Issue
Block a user