Authored by 陈轩

短信登陆 获取验证码提示修改

/* eslint no-unused-vars: ["error", { "args": "none" }] */
'use strict';
const _ = require('lodash');
const moment = require('moment');
const helpers = global.yoho.helpers;
const cookie = global.yoho.cookie;
const EventEmitter = require('events');
... ... @@ -14,7 +15,6 @@ const CODE_REQUIRED = '请输入校验码';
const PASSWORD_REQUIRED = '请输入密码';
const PASSWORD_LENGTH_ERROR = '密码6-20位,请重新输入';
const BAD_PASSWORD = '密码格式不正确';
const TOO_MANY = '请求太频繁';
const LOGIN_SUCCSS = '登录成功';
const VERIFY_ERROR = '校验失败';
... ... @@ -188,11 +188,14 @@ exports.tokenBefore = (req, res, next) => {
// 1. 过了冻结期, count 重设为 5次
// 2. 没过冻结期, end
// 没有用完, 判断是否请求太频繁
let during = moment.duration(interval - now, 'ms').minutes();
let message = `请${during}分钟后再试`;
if (!count) {
if (interval > now) {
return res.json({
code: 400,
message: TOO_MANY,
message: message,
during: Math.ceil((interval - now) / 1000)
});
} else {
... ... @@ -201,7 +204,7 @@ exports.tokenBefore = (req, res, next) => {
} else if (interval > now) {
return res.json({
code: 429,
message: TOO_MANY
message: message
});
}
... ...