Skip to content

Commit

Permalink
Merge pull request #190 from Liiuliu/0.3.2.7
Browse files Browse the repository at this point in the history
0.3.2.7
  • Loading branch information
xxxxbxxxxx authored Aug 27, 2021
2 parents 00e92dc + 2213873 commit ca84f64
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 6 deletions.
14 changes: 14 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,19 @@
## 更新日志

### v0.3.2.7

更新时间:2021-08-27

- 更新6个镜像。
- 新增自定义网站名称功能
- 新增多标签查询功能
- 新增头像上传功能
- 修改排行榜页面
- 修复docker-compose多次启动展示异常的bug
- 修复镜像启动异常的bug(需要删除镜像后重新添加)
- 修复镜像管理页面删除报错问题
- 优化页面样式。

### v0.3.2.6

更新时间:2021-07-24
Expand Down
16 changes: 10 additions & 6 deletions vulfocus-api/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -277,8 +277,15 @@ class SendEmailViewset(mixins.CreateModelMixin,viewsets.GenericViewSet):
def create(self, request, *args, **kwargs):
http_referer = request.META.get('HTTP_REFERER')
serializer = self.get_serializer(data=request.data)
serializer.is_valid(raise_exception=True)
username = request.data.get("username", None)
hashkey = request.data.get("hashkey", "")
captcha_code = request.data.get("captcha_code", "")
if not hashkey:
return JsonResponse({"code": 400, "msg": "验证码哈希值不能为空"})
if not captcha_code:
return JsonResponse({"code": 400, "msg": "验证码不能为空"})
if not judge_captcha(captcha_code, hashkey):
return JsonResponse({"code": 400, "msg": "验证码输入错误"})
if not User.objects.filter(username=username).count():
return JsonResponse({"code": 400, "msg": "该用户不存在"})
user = User.objects.get(username=username)
Expand All @@ -297,18 +304,15 @@ def create(self, request, *args, **kwargs):
send_from = s.docmd('MAIL FROM:<{}>'.format(EMAIL_HOST_USER))
message = MIMEText('请点击该链接{http_referer}#/updatepwd?code={code}'.format(http_referer=http_referer, code=code) + '。有效期为5分钟', 'plain', 'utf-8')
message['Subject'] = Header(u'找回密码', 'utf-8').encode()
send_from = s.sendmail(from_addr="{}".format(EMAIL_HOST_USER), to_addrs=user.email,
msg=message.as_string())
send_from = s.sendmail(from_addr="{}".format(EMAIL_HOST_USER), to_addrs=user.email, msg=message.as_string())
s.close()
except smtplib.SMTPDataError as e:
return JsonResponse({"code": 400, "msg": "您所绑定邮箱不可达,请验证该邮箱是否存在"})
else:
if not validate_email(user.email):
return JsonResponse({"code": 400, "msg": "您所绑定邮箱不可达,请验证该邮箱是否存在"})
try:
send_mail(subject="找回密码",
message="{http_referer}#/updatepwd?code={code}。有效期为5分钟".format(http_referer=http_referer, code=code),
from_email=EMAIL_FROM,
send_mail(subject="找回密码", message="{http_referer}#/updatepwd?code={code}。有效期为5分钟".format(http_referer=http_referer, code=code), from_email=EMAIL_FROM,
recipient_list=[user.email])
except:
return JsonResponse({"code": 400, "msg": "您所绑定邮箱不可达,请验证该邮箱是否存在"})
Expand Down

0 comments on commit ca84f64

Please sign in to comment.