1
0

tmpUid.js 744 B

12345678910111213141516171819202122232425262728293031
  1. /*
  2. * @Description: 临时id生成.
  3. * @Autor: kindring
  4. * @Date: 2022-01-17 16:49:32
  5. * @LastEditors: kindring
  6. * @LastEditTime: 2022-01-17 16:58:03
  7. * @LastDescript:
  8. */
  9. // 1. 用户浏览器请求验证码
  10. // 2. 服务器生成临时标识,顺便生成验证码图片,存储redis
  11. // 3. 用户输入验证码发送到后端
  12. /**
  13. * 生成是否登录中间件
  14. * @param {*} req
  15. * @param {*} res
  16. * @param {*} next
  17. */
  18. function checkTmpUid(req, res, next) {
  19. // 只在未登陆时创建临时uid
  20. if (!req.session.owner) {
  21. // 如果有临时凭证则自动生成,没有则跳过
  22. if (req.session.tmpUid) {
  23. // 延长过期时间
  24. } else {
  25. // 生成临时id
  26. }
  27. }
  28. next();
  29. }