mirror of https://github.com/jumpserver/jumpserver
[Update] 修改api
parent
12e1e559b5
commit
edce831e46
|
@ -108,10 +108,10 @@ def generate_data(username, request):
|
|||
user_agent = request.META.get('HTTP_USER_AGENT', '')
|
||||
|
||||
if isinstance(request, Request):
|
||||
login_ip = request.data.get('remote_addr', None)
|
||||
login_ip = request.data.get('remote_addr', '0.0.0.0')
|
||||
login_type = request.data.get('login_type', '')
|
||||
else:
|
||||
login_ip = get_request_ip(request)
|
||||
login_ip = get_request_ip(request) or '0.0.0.0'
|
||||
login_type = 'W'
|
||||
|
||||
data = {
|
||||
|
|
|
@ -50,7 +50,7 @@ class UserOrderAcceptAuthApi(APIView):
|
|||
elif order.status == order.STATUS_REJECTED:
|
||||
raise errors.LoginConfirmRejectedError(order_id)
|
||||
else:
|
||||
return errors.LoginConfirmWaitError(order_id)
|
||||
raise errors.LoginConfirmWaitError(order_id)
|
||||
except errors.AuthFailedError as e:
|
||||
data = e.as_data()
|
||||
return Response(data, status=400)
|
||||
|
|
|
@ -36,4 +36,4 @@ class TokenCreateApi(AuthMixin, CreateAPIView):
|
|||
resp = super().create(request, *args, **kwargs)
|
||||
return resp
|
||||
except errors.AuthFailedError as e:
|
||||
return Response(e.as_data(), status=401)
|
||||
return Response(e.as_data(), status=400)
|
||||
|
|
|
@ -139,8 +139,10 @@ class MFARequiredError(AuthFailedError):
|
|||
return {
|
||||
'error': self.error,
|
||||
'msg': self.msg,
|
||||
'choices': ['otp'],
|
||||
'url': reverse('api-auth:mfa-challenge')
|
||||
'data': {
|
||||
'choices': ['otp'],
|
||||
'url': reverse('api-auth:mfa-challenge')
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -161,7 +163,9 @@ class LoginConfirmError(AuthFailedError):
|
|||
return {
|
||||
"error": self.error,
|
||||
"msg": self.msg,
|
||||
"order_id": self.order_id
|
||||
"data": {
|
||||
"order_id": self.order_id
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -114,6 +114,7 @@ class AuthMixin:
|
|||
self.request.session['auth_password'] = ''
|
||||
self.request.session['auth_mfa'] = ''
|
||||
self.request.session['auth_confirm'] = ''
|
||||
self.request.session['auth_order_id'] = ''
|
||||
|
||||
def send_auth_signal(self, success=True, user=None, username='', reason=''):
|
||||
if success:
|
||||
|
|
|
@ -20,7 +20,6 @@ def on_login_confirm_order_assignees_set(sender, instance=None, action=None,
|
|||
if action == 'post_add':
|
||||
logger.debug('New order create, send mail: {}'.format(instance.id))
|
||||
assignees = model.objects.filter(pk__in=pk_set)
|
||||
print(assignees)
|
||||
send_login_confirm_order_mail_to_assignees(instance, assignees)
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue