diff --git a/History.md b/History.md index 9036055..1a082dd 100644 --- a/History.md +++ b/History.md @@ -1,3 +1,9 @@ +1.1.3 / 2016-04-05 +================== + +* 增加ismobilejs库, 移动端登录不用验证码. + + 1.1.2 / 2016-04-04 ================== diff --git a/logs/development-error.log.0 b/logs/development-error.log.0 new file mode 100644 index 0000000..e69de29 diff --git a/logs/test-error.log.0 b/logs/test-error.log.0 new file mode 100644 index 0000000..5c03fe5 --- /dev/null +++ b/logs/test-error.log.0 @@ -0,0 +1,12 @@ +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8189,"level":50,"msg":"登录密码错误 { username: 'test011459702513799@tets.com' }","time":"2016-04-03T16:55:16.191Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8189,"level":50,"msg":"登录用户名错误 { username: 'ttttt@ttttt.com' }","time":"2016-04-03T16:55:16.199Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8189,"level":50,"msg":"未验证用户登录 { username: 'test021459702513799@tets.com' }","time":"2016-04-03T16:55:16.259Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8189,"level":50,"msg":"被阻止登录 { username: 'test031459702513799@tets.com' }","time":"2016-04-03T16:55:16.314Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8281,"level":50,"msg":"登录密码错误 { username: 'test011459702638217@tets.com' }","time":"2016-04-03T16:57:20.196Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8281,"level":50,"msg":"登录用户名错误 { username: 'ttttt@ttttt.com' }","time":"2016-04-03T16:57:20.206Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8281,"level":50,"msg":"未验证用户登录 { username: 'test021459702638217@tets.com' }","time":"2016-04-03T16:57:20.258Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8281,"level":50,"msg":"被阻止登录 { username: 'test031459702638217@tets.com' }","time":"2016-04-03T16:57:20.305Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8355,"level":50,"msg":"登录密码错误 { username: 'test011459702736901@tets.com' }","time":"2016-04-03T16:58:59.034Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8355,"level":50,"msg":"登录用户名错误 { username: 'ttttt@ttttt.com' }","time":"2016-04-03T16:58:59.041Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8355,"level":50,"msg":"未验证用户登录 { username: 'test021459702736901@tets.com' }","time":"2016-04-03T16:58:59.093Z","v":0} +{"name":"jackblog","hostname":"hugongzideMacBook-Air.local","pid":8355,"level":50,"msg":"被阻止登录 { username: 'test031459702736901@tets.com' }","time":"2016-04-03T16:58:59.139Z","v":0} diff --git a/package.json b/package.json index 05f0a61..6d6a9c9 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jackblog-api-koa", - "version": "1.1.2", + "version": "1.1.3", "description": "jackblog API koa版", "main": "server/app.js", "scripts": { @@ -29,6 +29,7 @@ "co": "^4.6.0", "debug": "^2.2.0", "ioredis": "^1.15.1", + "ismobilejs": "^0.4.0", "koa": "^1.2.0", "koa-bodyparser": "^2.0.1", "koa-compose": "^2.4.0", @@ -44,9 +45,9 @@ "koa-redis": "^2.0.1", "koa-response-time": "^1.0.2", "koa-router": "^5.3.0", - "lodash": "^4.7.0", + "lodash": "^4.8.2", "markdown-it": "^6.0.1", - "mongoose": "^4.4.10", + "mongoose": "^4.4.11", "passport-github": "^1.1.0", "passport-local": "^1.0.0", "passport-qq": "0.0.3", diff --git a/server/auth/local/index.js b/server/auth/local/index.js index cc52fd6..613d146 100644 --- a/server/auth/local/index.js +++ b/server/auth/local/index.js @@ -3,14 +3,15 @@ const mongoose = require('mongoose'); const router = require("koa-router")(); const passport = require('koa-passport'); -const auth = require('../auth.service'); const User = mongoose.model('User'); +const isMobile = require('ismobilejs'); +const auth = require('../auth.service'); function checkCaptcha() { return function *(next) { //测试环境不用验证码 let error_msg; - if(process.env.NODE_ENV !== 'test'){ + if(process.env.NODE_ENV !== 'test' && !isMobile(this.req.headers['user-agent']).any){ if(!this.request.body.captcha){ error_msg = "验证码不能为空."; }else if(this.session.captcha !== this.request.body.captcha.toUpperCase()){