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
Plain Diff
Browse Files
Authored by
陈轩
8 years ago
Commit
609787f88ac13c268816b1dfc5b78d67ccdb1d1d
2 parents
46aa9282
b7b7af17
Merge branch 'hotfix/register' into release/5.2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
53 deletions
apps/passport/controllers/reg.js
public/js/passport/register/password.js
apps/passport/controllers/reg.js
View file @
609787f
...
...
@@ -242,6 +242,7 @@ let sendCode = (req, res, next) => {
}
}).
catch
(
next
);
};
let
verifyCode
=
(
req
,
res
,
next
)
=>
{
let
data
=
{
code
:
400
,
...
...
@@ -298,20 +299,19 @@ let verifyCode = (req, res, next) => {
/**
* Step3: set Password
*/
let
passwordAction
=
(
req
,
res
)
=>
{
let
passwordAction
=
(
req
,
res
,
next
)
=>
{
let
token
=
req
.
query
.
token
;
let
mobile
=
+
req
.
query
.
phoneNum
;
let
area
=
+
(
req
.
query
.
areaCode
||
86
);
let
smsCode
=
+
req
.
query
.
smsCode
;
// 判断是否允许访问, 不允许则跳转到错误页面
// if (!smsCode || !_.isString(token) || !_.isNumber(mobile) || !_.isNumber(area) || !sign.verifyToken(mobile, token)) {
// return next({
// code: 403,
// message: 'error token, mobile or verifyCode'
// });
// }
if
(
!
smsCode
||
!
_
.
isString
(
token
)
||
!
_
.
isNumber
(
mobile
)
||
!
_
.
isNumber
(
area
)
||
!
sign
.
verifyToken
(
mobile
,
token
))
{
return
next
({
code
:
403
,
message
:
'error token, mobile or verifyCode'
});
}
res
.
render
(
'reg/password'
,
{
page
:
'password'
,
...
...
public/js/passport/register/password.js
View file @
609787f
...
...
@@ -44,7 +44,7 @@ if (qs.selected && qs.selected === 'N') {
$
(
'.pitch'
).
removeClass
(
'select'
).
html
(
''
);
}
if
(
qs
.
pwd
)
{
if
(
qs
.
pwd
)
{
$pwd
.
val
(
qs
.
pwd
);
if
(
trim
(
$pwd
.
val
())
===
''
)
{
...
...
@@ -64,6 +64,31 @@ $('.pitch').on('click', function() {
}
});
function
setPassword
()
{
return
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/reg/setpassword'
,
data
:
{
password
:
trim
(
$pwd
.
val
()),
phoneNum
:
$
(
'#phone-num'
).
val
(),
areaCode
:
$
(
'#area-code'
).
val
(),
smsCode
:
$
(
'#sms-code'
).
val
(),
token
:
$
(
'#token'
).
val
()
},
success
:
function
(
data
)
{
var
res
=
data
.
data
;
if
(
data
.
code
===
200
)
{
showErrTip
(
'注册成功'
);
location
.
href
=
res
.
href
;
}
else
{
showErrTip
(
data
.
message
);
}
}
});
}
$btnSure
.
on
(
'touchstart'
,
function
()
{
var
pwd
=
trim
(
$pwd
.
val
());
...
...
@@ -74,30 +99,8 @@ $btnSure.on('touchstart', function() {
if
(
!
validatePWD
(
pwd
))
{
showErrTip
(
'密码6-20位,请重新输入'
);
}
else
{
if
(
$
(
'.pitch'
).
hasClass
(
'select'
))
{
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/reg/setpassword'
,
data
:
{
password
:
pwd
,
phoneNum
:
$
(
'#phone-num'
).
val
(),
areaCode
:
$
(
'#area-code'
).
val
(),
smsCode
:
$
(
'#sms-code'
).
val
(),
token
:
$
(
'#token'
).
val
()
},
success
:
function
(
data
)
{
var
res
=
data
.
data
;
if
(
data
.
code
===
200
)
{
showErrTip
(
'注册成功'
);
location
.
href
=
res
.
href
;
}
else
{
showErrTip
(
data
.
message
);
}
}
});
setPassword
();
}
else
{
$
(
'.prompt'
).
show
();
...
...
@@ -106,27 +109,7 @@ $btnSure.on('touchstart', function() {
$
(
'.pitch'
).
addClass
(
'select'
);
$
(
'.pitch'
).
html
(
''
);
$
.
ajax
({
type
:
'POST'
,
url
:
'/passport/reg/setpassword'
,
data
:
{
password
:
pwd
,
phoneNum
:
$
(
'#phone-num'
).
val
(),
areaCode
:
$
(
'#area-code'
).
val
(),
token
:
$
(
'#token'
).
val
()
},
success
:
function
(
data
)
{
var
res
=
data
.
data
;
if
(
data
.
code
===
200
)
{
showErrTip
(
'注册成功'
);
location
.
href
=
res
.
href
;
}
else
{
showErrTip
(
data
.
message
);
}
}
});
setPassword
();
});
$
(
'.deny'
).
on
(
'click'
,
function
()
{
...
...
Please
register
or
login
to post a comment