Authored by yyq

Merge branch 'master' into gray

... ... @@ -53,11 +53,12 @@ passport.use('local', new LocalStrategy({
let clientIp = req.yoho.clientIp;
let errorLoginKey = 'loginErrorIp:' + clientIp;
let close = _.get(req.app.locals.pc, 'login.closePasswordLogin', false);
getLoginStat(clientIp).then((times) => {
let errLoginTimes = _.parseInt(times) || 0;
return LoginApi.signin(type, area, username, password, shoppingKey, clientIp).then((result) => {
return LoginApi.signin(type, area, username, password, shoppingKey, clientIp, close).then((result) => {
if (result.code && (result.code === 200 || result.code === 510) && result.data.uid) {
cache.del(errorLoginKey).catch(() => {});
req.session.type = '';
... ...
... ... @@ -27,6 +27,10 @@ module.exports = class extends global.yoho.BaseModel {
return this._checkUniverse(captcha)
.catch(() => this.api.check(id, captcha))
.then((result) => {
logger.info(`app.verified.graphic [${captcha}] result: `, result);
return result;
})
.then((result) => {
if (result.code === 200) {
return {
code: 200,
... ...
... ... @@ -20,13 +20,17 @@ const userService = require('./user-service');
const api = require('./login-api');
const logger = global.yoho.logger;
const signin = (type, area, profile, password, shoppingKey, clientIp) => {
const signin = (type, area, profile, password, shoppingKey, clientIp, closePasswordLogin) => {
let loginBy = {
password: api.signinByPasswordWithAes,
sms: api.signinBySMS,
qrcode: api.signinByQrCode
};
if (closePasswordLogin) {
delete loginBy.password;
}
return loginBy[type](area, profile, password, shoppingKey, clientIp);
};
... ...
... ... @@ -33,3 +33,5 @@
</div>
{{/ verification}}
</div>
{{> gee-captcha}}
... ...
... ... @@ -33,13 +33,15 @@
</li>
<li class="relative">
<div class="switch">
<div class="switch {{#if @root.pc.login.closePasswordLogin}}hide{{/if}}">
{{#unless @root.pc.login.closePasswordLogin}}
<div class="left selected" data-type="PasswordLogin">普通登录</div>
<div class="right" data-type="SMSLogin">手机验证码登录</div>
{{/unless}}
<div class="right {{#if @root.pc.login.closePasswordLogin}}selected hide{{/if}}" data-type="SMSLogin">手机验证码登录</div>
</div>
</li>
<li class="relative password-login">
<li class="relative password-login {{#if @root.pc.login.closePasswordLogin}}hide{{/if}}">
<input id="account1" class="account input va" name="account" value="{{bindMobile}}"
type="text"
placeholder="邮箱/手机号码" autocomplete="off">
... ... @@ -49,7 +51,7 @@
</span>
</li>
<li class="relative password-login">
<li class="relative password-login {{#if @root.pc.login.closePasswordLogin}}hide{{/if}}">
<input id="password" class="password input va" name="password" type="password"
placeholder="密码"
autocomplete="off" maxlength="20">
... ... @@ -63,7 +65,7 @@
<li class="clearfix password-login captcha-wrap hide">
</li>
<li class="relative clearfix sms-login hide">
<li class="relative clearfix sms-login {{#unless @root.pc.login.closePasswordLogin}}hide{{/unless}}">
<input id="account2" class="account input va" name="account2" value="{{bindMobile}}"
type="text"
placeholder="手机号码" autocomplete="off">
... ... @@ -73,10 +75,10 @@
</span>
</li>
<li class="clearfix sms-captcha-img-wrap sms-login hide">
<li class="clearfix sms-captcha-img-wrap sms-login {{#unless @root.pc.login.closePasswordLogin}}hide{{/unless}}">
</li>
<li class="relative clearfix sms-login hide">
<li class="relative clearfix sms-login {{#unless @root.pc.login.closePasswordLogin}}hide{{/unless}}">
<input id="captcha-sms" class="input va captcha-sms-input" type="text" name="captcha"
placeholder="短信验证码"
autocomplete="off" maxlength="4">
... ...
... ... @@ -17,12 +17,12 @@ module.exports = {
cookieDomain: '.yohobuy.com',
domains: {
// test3
// singleApi: 'http://api-test3.yohops.com:9999/',
// api: 'http://api-test3.yohops.com:9999/',
// service: 'http://service-test3.yohops.com:9999/',
// serviceNotify: 'http://service-test3.yohops.com:9999/',
// global: 'http://global-test-soa.yohops.com:9999/',
// platformApi: 'http://192.168.102.48:8088/',
singleApi: 'http://api-test3.yohops.com:9999/',
api: 'http://api-test3.yohops.com:9999/',
service: 'http://service-test3.yohops.com:9999/',
serviceNotify: 'http://service-test3.yohops.com:9999/',
global: 'http://global-test-soa.yohops.com:9999/',
platformApi: 'http://192.168.102.48:8088/',
// test2
// singleApi: 'http://api-test2.yohops.com:9999/',
... ... @@ -33,12 +33,12 @@ module.exports = {
// platformApi: 'http://192.168.102.48:8088/',
// prod
singleApi: 'http://single.yoho.cn/',
api: 'http://api.yoho.cn/',
service: 'http://service.yoho.cn/',
serviceNotify: 'http://service.yoho.cn/',
global: 'http://api-global.yohobuy.com/',
platformApi: 'http://172.16.6.210:8088/',
// singleApi: 'http://single.yoho.cn/',
// api: 'http://api.yoho.cn/',
// service: 'http://service.yoho.cn/',
// serviceNotify: 'http://service.yoho.cn/',
// global: 'http://api-global.yohobuy.com/',
// platformApi: 'http://172.16.6.210:8088/',
// gray
// singleApi: 'http://single.gray.yohops.com/',
... ...