feat(authentication): 超级管理员密码不能是admin

This commit is contained in:
xinwen
2020-08-05 16:04:05 +08:00
committed by 老广
parent 15fe7f810b
commit a25da8d479
8 changed files with 65 additions and 11 deletions

View File

@@ -1,6 +1,6 @@
# -*- coding: utf-8 -*-
#
from django.shortcuts import redirect
from rest_framework.permissions import AllowAny
from rest_framework.response import Response
from rest_framework.generics import CreateAPIView
@@ -40,3 +40,5 @@ class TokenCreateApi(AuthMixin, CreateAPIView):
return Response(e.as_data(), status=400)
except errors.NeedMoreInfoError as e:
return Response(e.as_data(), status=200)
except errors.PasswdTooSimple as e:
return redirect(e.url)