Showing
6 changed files
with
50 additions
and
2 deletions
@@ -12,6 +12,7 @@ const cookie = global.yoho.cookie; | @@ -12,6 +12,7 @@ const cookie = global.yoho.cookie; | ||
12 | const helpers = global.yoho.helpers; | 12 | const helpers = global.yoho.helpers; |
13 | const log = global.yoho.logger; | 13 | const log = global.yoho.logger; |
14 | const config = global.yoho.config; | 14 | const config = global.yoho.config; |
15 | +const RegService = require('../models/reg-service'); | ||
15 | const AuthHelper = require('../models/auth-helper'); | 16 | const AuthHelper = require('../models/auth-helper'); |
16 | 17 | ||
17 | const loginPage = `${config.siteUrl}/passport/login`; | 18 | const loginPage = `${config.siteUrl}/passport/login`; |
@@ -94,7 +95,7 @@ const local = { | @@ -94,7 +95,7 @@ const local = { | ||
94 | weiboLoginUrl: '/passport/login/sina', // 微博登录的URL链接 | 95 | weiboLoginUrl: '/passport/login/sina', // 微博登录的URL链接 |
95 | qqLoginUrl: '/passport/login/qq', // 腾讯QQ登录的URL链接 | 96 | qqLoginUrl: '/passport/login/qq', // 腾讯QQ登录的URL链接 |
96 | wechatLoginUrl: '/passport/login/wechat', // 微信登录的URL链接 | 97 | wechatLoginUrl: '/passport/login/wechat', // 微信登录的URL链接 |
97 | - internationalUrl: '/login.html', // 国际号登录的URL链接 | 98 | + internationalUrl: '/passport/international', // 国际号登录的URL链接 |
98 | phoneRetriveUrl: '/passport/back/mobile', // 通过手机号找回密码的URL链接 | 99 | phoneRetriveUrl: '/passport/back/mobile', // 通过手机号找回密码的URL链接 |
99 | emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接 | 100 | emailRetriveUrl: '/passport/back/email', // 通过邮箱找回密码的URL链接 |
100 | module: 'passport', | 101 | module: 'passport', |
@@ -102,6 +103,36 @@ const local = { | @@ -102,6 +103,36 @@ const local = { | ||
102 | title: '登录' | 103 | title: '登录' |
103 | }); | 104 | }); |
104 | }, | 105 | }, |
106 | + international: (req, res) => { | ||
107 | + // 先清除cookie | ||
108 | + res.clearCookie('LE' + md5('_LOGIN_EXPIRE'), { | ||
109 | + domain: 'yohobuy.com' | ||
110 | + }); | ||
111 | + | ||
112 | + // 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie | ||
113 | + res.cookie('LE' + md5('_LOGIN_EXPIRE'), (new Date()).getTime() / 1000 + 1800); | ||
114 | + | ||
115 | + // 清除cookie | ||
116 | + res.clearCookie('_UID', { | ||
117 | + domain: 'yohobuy.com' | ||
118 | + }); | ||
119 | + res.clearCookie('_TOKEN', { | ||
120 | + domain: 'yohobuy.com' | ||
121 | + }); | ||
122 | + | ||
123 | + res.render('international', { | ||
124 | + // 返回的URL链接 | ||
125 | + backUrl: 'javascript:history.go(-1)', // eslint-disable-line | ||
126 | + loginInternational: true, // 模板中使用JS的标识 | ||
127 | + isPassportPage: true, // 模板中模块标识 | ||
128 | + headerText: '登录', | ||
129 | + areaCode: '+86', // 默认区号 | ||
130 | + countrys: RegService.getAreaData(), // 地区信息列表 | ||
131 | + module: 'passport', | ||
132 | + page: 'international', | ||
133 | + title: '国际账号登录' | ||
134 | + }); | ||
135 | + }, | ||
105 | login: (req, res, next) => { | 136 | login: (req, res, next) => { |
106 | passport.authenticate('local', (err, user) => { | 137 | passport.authenticate('local', (err, user) => { |
107 | if (err) { | 138 | if (err) { |
@@ -25,6 +25,7 @@ router.get('/passport/signout/index', login.local.logout); | @@ -25,6 +25,7 @@ router.get('/passport/signout/index', login.local.logout); | ||
25 | 25 | ||
26 | // 登录页面 | 26 | // 登录页面 |
27 | router.get('/passport/login', login.common.beforeLogin, login.local.loginPage); | 27 | router.get('/passport/login', login.common.beforeLogin, login.local.loginPage); |
28 | +router.get('/passport/international', login.common.beforeLogin, login.local.international); | ||
28 | 29 | ||
29 | // 本地登录 | 30 | // 本地登录 |
30 | router.post('/passport/login/auth', login.local.login); | 31 | router.post('/passport/login/auth', login.local.login); |
apps/passport/views/action/international.hbs
0 → 100644
1 | +<div class="login-international-page passport-page yoho-page"> | ||
2 | + {{> passport/header}} | ||
3 | + <div class="content"> | ||
4 | + {{> passport/country_list}} | ||
5 | + <div class="input-container phone-container row has-clear"> | ||
6 | + <span id="area-code" class="area-code">{{areaCode}}</span> | ||
7 | + <input id="phone-num" class="input phone-num" type="text" placeholder="手机号" value={{phoneNum}}> | ||
8 | + </div> | ||
9 | + <div class="input-container row has-eye"> | ||
10 | + <input id="pwd" class="pwd input" type="password" placeholder="密码"> | ||
11 | + </div> | ||
12 | + <span id="btn-login" class="btn btn-login disble row">登录</span> | ||
13 | + </div> | ||
14 | +</div> |
@@ -11,6 +11,7 @@ module.exports = app => { | @@ -11,6 +11,7 @@ module.exports = app => { | ||
11 | // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了 | 11 | // 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了 |
12 | app.use(require('./apps/channel')); | 12 | app.use(require('./apps/channel')); |
13 | app.use(require('./apps/passport')); | 13 | app.use(require('./apps/passport')); |
14 | + | ||
14 | // 业务模块 | 15 | // 业务模块 |
15 | app.use('/product', require('./apps/product')); | 16 | app.use('/product', require('./apps/product')); |
16 | app.use('/guang', require('./apps/guang')); | 17 | app.use('/guang', require('./apps/guang')); |
public/js/passport/international.page.js
0 → 100644
1 | +require('./login/international'); |
@@ -3,7 +3,7 @@ | @@ -3,7 +3,7 @@ | ||
3 | * @author: xuqi<qi.xu@yoho.cn> | 3 | * @author: xuqi<qi.xu@yoho.cn> |
4 | * @date: 2015/10/8 | 4 | * @date: 2015/10/8 |
5 | */ | 5 | */ |
6 | -var $ = require('jquery'); | 6 | +var $ = require('yoho-jquery'); |
7 | 7 | ||
8 | var $phoneNum = $('#phone-num'), | 8 | var $phoneNum = $('#phone-num'), |
9 | $countrySelect = $('#country-select'), | 9 | $countrySelect = $('#country-select'), |
-
Please register or login to post a comment