Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yohobuywap-node
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
0
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
王水玲
9 years ago
Commit
09af82ce5960fdeec6edb808749f0f40bfb3f90c
1 parent
f34f8f21
国际账号登录
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
50 additions
and
2 deletions
apps/passport/controllers/login.js
apps/passport/router.js
apps/passport/views/action/international.hbs
dispatch.js
public/js/passport/international.page.js
public/js/passport/login/international.js
apps/passport/controllers/login.js
View file @
09af82c
...
...
@@ -12,6 +12,7 @@ const cookie = global.yoho.cookie;
const
helpers
=
global
.
yoho
.
helpers
;
const
log
=
global
.
yoho
.
logger
;
const
config
=
global
.
yoho
.
config
;
const
RegService
=
require
(
'../models/reg-service'
);
const
AuthHelper
=
require
(
'../models/auth-helper'
);
const
loginPage
=
`
$
{
config
.
siteUrl
}
/passport/
login
`
;
...
...
@@ -94,7 +95,7 @@ const local = {
weiboLoginUrl
:
'/passport/login/sina'
,
// 微博登录的URL链接
qqLoginUrl
:
'/passport/login/qq'
,
// 腾讯QQ登录的URL链接
wechatLoginUrl
:
'/passport/login/wechat'
,
// 微信登录的URL链接
internationalUrl
:
'/
login.htm
l'
,
// 国际号登录的URL链接
internationalUrl
:
'/
passport/internationa
l'
,
// 国际号登录的URL链接
phoneRetriveUrl
:
'/passport/back/mobile'
,
// 通过手机号找回密码的URL链接
emailRetriveUrl
:
'/passport/back/email'
,
// 通过邮箱找回密码的URL链接
module
:
'passport'
,
...
...
@@ -102,6 +103,36 @@ const local = {
title
:
'登录'
});
},
international
:
(
req
,
res
)
=>
{
// 先清除cookie
res
.
clearCookie
(
'LE'
+
md5
(
'_LOGIN_EXPIRE'
),
{
domain
:
'yohobuy.com'
});
// 设置登录有效时间30分钟, 防机器刷,cache不稳定,改为cookie
res
.
cookie
(
'LE'
+
md5
(
'_LOGIN_EXPIRE'
),
(
new
Date
()).
getTime
()
/
1000
+
1800
);
// 清除cookie
res
.
clearCookie
(
'_UID'
,
{
domain
:
'yohobuy.com'
});
res
.
clearCookie
(
'_TOKEN'
,
{
domain
:
'yohobuy.com'
});
res
.
render
(
'international'
,
{
// 返回的URL链接
backUrl
:
'javascript:history.go(-1)'
,
// eslint-disable-line
loginInternational
:
true
,
// 模板中使用JS的标识
isPassportPage
:
true
,
// 模板中模块标识
headerText
:
'登录'
,
areaCode
:
'+86'
,
// 默认区号
countrys
:
RegService
.
getAreaData
(),
// 地区信息列表
module
:
'passport'
,
page
:
'international'
,
title
:
'国际账号登录'
});
},
login
:
(
req
,
res
,
next
)
=>
{
passport
.
authenticate
(
'local'
,
(
err
,
user
)
=>
{
if
(
err
)
{
...
...
apps/passport/router.js
View file @
09af82c
...
...
@@ -25,6 +25,7 @@ router.get('/passport/signout/index', login.local.logout);
// 登录页面
router
.
get
(
'/passport/login'
,
login
.
common
.
beforeLogin
,
login
.
local
.
loginPage
);
router
.
get
(
'/passport/international'
,
login
.
common
.
beforeLogin
,
login
.
local
.
international
);
// 本地登录
router
.
post
(
'/passport/login/auth'
,
login
.
local
.
login
);
...
...
apps/passport/views/action/international.hbs
0 → 100644
View file @
09af82c
<div
class=
"login-international-page passport-page yoho-page"
>
{{>
passport
/
header
}}
<div
class=
"content"
>
{{>
passport
/
country_list
}}
<div
class=
"input-container phone-container row has-clear"
>
<span
id=
"area-code"
class=
"area-code"
>
{{
areaCode
}}
</span>
<input
id=
"phone-num"
class=
"input phone-num"
type=
"text"
placeholder=
"手机号"
value=
{{
phoneNum
}}
>
</div
>
<div
class=
"input-container row has-eye"
>
<input
id=
"pwd"
class=
"pwd input"
type=
"password"
placeholder=
"密码"
>
</div>
<span
id=
"btn-login"
class=
"btn btn-login disble row"
>
登录
</span>
</div>
</div>
\ No newline at end of file
...
...
dispatch.js
View file @
09af82c
...
...
@@ -11,6 +11,7 @@ module.exports = app => {
// 四个频道页,频道选择页面 /boys,/girls,/,/kids,/lifestyle 等页面,就直接占用路由了
app
.
use
(
require
(
'./apps/channel'
));
app
.
use
(
require
(
'./apps/passport'
));
// 业务模块
app
.
use
(
'/product'
,
require
(
'./apps/product'
));
app
.
use
(
'/guang'
,
require
(
'./apps/guang'
));
...
...
public/js/passport/international.page.js
0 → 100644
View file @
09af82c
require
(
'./login/international'
);
...
...
public/js/passport/login/international.js
View file @
09af82c
...
...
@@ -3,7 +3,7 @@
* @author: xuqi<qi.xu@yoho.cn>
* @date: 2015/10/8
*/
var
$
=
require
(
'jquery'
);
var
$
=
require
(
'
yoho-
jquery'
);
var
$phoneNum
=
$
(
'#phone-num'
),
$countrySelect
=
$
(
'#country-select'
),
...
...
Please
register
or
login
to post a comment