|
|
@ -425,7 +425,7 @@ class UserInfoView(APIView): |
|
|
|
res = BaseResponse() |
|
|
|
res = BaseResponse() |
|
|
|
serializer = UserInfoSerializer(request.user) |
|
|
|
serializer = UserInfoSerializer(request.user) |
|
|
|
res.data = serializer.data |
|
|
|
res.data = serializer.data |
|
|
|
|
|
|
|
res.data['login_type'] = get_login_type() |
|
|
|
return Response(res.dict) |
|
|
|
return Response(res.dict) |
|
|
|
|
|
|
|
|
|
|
|
def put(self, request): |
|
|
|
def put(self, request): |
|
|
@ -466,22 +466,22 @@ class UserInfoView(APIView): |
|
|
|
res.code = 1004 |
|
|
|
res.code = 1004 |
|
|
|
res.msg = "老密码校验失败" |
|
|
|
res.msg = "老密码校验失败" |
|
|
|
else: |
|
|
|
else: |
|
|
|
username = data.get("username", None) |
|
|
|
if get_login_type().get('up'): |
|
|
|
if username and username != request.user.username: |
|
|
|
username = data.get("username", None) |
|
|
|
if check_username_exists(username): |
|
|
|
if username and username != request.user.username: |
|
|
|
res.msg = "用户名已经存在" |
|
|
|
if check_username_exists(username): |
|
|
|
res.code = 1005 |
|
|
|
res.msg = "用户名已经存在" |
|
|
|
logger.error(f"User {request.user} info save failed. username already exists") |
|
|
|
res.code = 1005 |
|
|
|
return Response(res.dict) |
|
|
|
logger.error(f"User {request.user} info save failed. username already exists") |
|
|
|
if len(username) < 6: |
|
|
|
return Response(res.dict) |
|
|
|
res.msg = "用户名至少6位" |
|
|
|
if len(username) < 6: |
|
|
|
res.code = 1006 |
|
|
|
res.msg = "用户名至少6位" |
|
|
|
return Response(res.dict) |
|
|
|
res.code = 1006 |
|
|
|
|
|
|
|
return Response(res.dict) |
|
|
|
|
|
|
|
request.user.username = data.get("username", request.user.username) |
|
|
|
|
|
|
|
|
|
|
|
request.user.job = data.get("job", request.user.job) |
|
|
|
request.user.job = data.get("job", request.user.job) |
|
|
|
request.user.first_name = data.get("first_name", request.user.first_name) |
|
|
|
request.user.first_name = data.get("first_name", request.user.first_name) |
|
|
|
request.user.username = data.get("username", request.user.username) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
sms_token = data.get("auth_token", None) |
|
|
|
sms_token = data.get("auth_token", None) |
|
|
|
if sms_token: |
|
|
|
if sms_token: |
|
|
|
act = data.get("act", None) |
|
|
|
act = data.get("act", None) |
|
|
|