mirror of https://github.com/jumpserver/jumpserver
perf: passkey 只允许本地用户开启
parent
7cd2736e82
commit
38aa828eb8
|
@ -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'
|
||||
|
|
Loading…
Reference in New Issue