Toggle navigation
Toggle navigation
This project
Loading...
Sign in
fe
/
yoho-blk
·
Commits
Go to a project
GitLab
Go to group
Project
Activity
Files
Commits
Pipelines
0
Builds
0
Graphs
Milestones
Issues
0
Merge Requests
1
Members
Labels
Wiki
Forks
Network
Create a new issue
Download as
Email Patches
Plain Diff
Browse Files
Authored by
htoooth
9 years ago
Commit
c7594cf029a4c2d3133b1821dc991296d63b9d34
1 parent
f4feb046
调整找回密码页。
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
40 deletions
apps/passport/views/action/back/reset-pwd.hbs
public/js/passport/back/reset.js
apps/passport/views/action/back/reset-pwd.hbs
View file @
c7594cf
...
...
@@ -67,7 +67,7 @@
<li>
<div>
<
input
id=
"reset-pwd-btn"
class=
"reset-pwd-btn disable"
type=
"submit"
value=
"下一步"
disabled
>
<
a
id=
"reset-pwd-btn"
class=
"reset-pwd-btn"
>
下一步
</a
>
</div>
</li>
...
...
public/js/passport/back/reset.js
View file @
c7594cf
...
...
@@ -10,10 +10,6 @@ var $passwordInput = $('#pwd'),
$repasswordInput
=
$
(
'#re-input'
),
$next
=
$
(
'#reset-pwd-btn'
);
var
EventProxy
=
require
(
'yoho-eventproxy'
);
var
ep
=
new
EventProxy
();
var
pwdRegx
=
require
(
'../common/mail-phone-regx'
).
pwdValidateRegx
;
function
errTip
(
ele
,
msg
)
{
...
...
@@ -34,75 +30,65 @@ require('yoho-jquery-placeholder');
// IE8 placeholder
$
(
'input'
).
placeholder
();
// 同时监听 pwd 和 repwd 事件
ep
.
tail
(
'pwd'
,
'repwd'
,
function
(
pwd
,
repwd
)
{
if
(
pwd
&&
repwd
)
{
$next
.
removeClass
(
'disable'
).
prop
(
'disabled'
,
false
);
}
else
{
$next
.
addClass
(
'disable'
).
prop
(
'disabled'
,
true
);
}
});
$passwordInput
.
on
(
'keyup blur'
,
function
()
{
function
validatePassword
()
{
var
length
=
$passwordInput
.
val
().
length
;
if
(
length
===
0
)
{
errTip
(
$passwordInput
,
'请输入密码'
);
ep
.
emit
(
'pwd'
,
false
);
return
;
return
false
;
}
if
(
length
<
6
||
length
>
20
)
{
errTip
(
$passwordInput
,
'密码只支持 6-20 位字符,建议字母+数字的组合'
);
ep
.
emit
(
'pwd'
,
false
);
return
;
return
false
;
}
if
(
!
pwdRegx
.
test
(
$passwordInput
.
val
()))
{
errTip
(
$passwordInput
,
'密码只支持 6-20 位字符,建议字母+数字的组合'
);
ep
.
emit
(
'pwd'
,
false
);
return
;
return
false
;
}
ep
.
emit
(
'pwd'
,
true
);
hideTip
(
$passwordInput
);
return
true
;
}
$passwordInput
.
on
(
'blur'
,
function
()
{
validatePassword
();
}).
on
(
'focus'
,
function
()
{
$passwordInput
.
addClass
(
'focus'
);
hideTip
(
$passwordInput
);
}).
on
(
'blur'
,
function
()
{
$passwordInput
.
removeClass
(
'focus'
);
});
$repasswordInput
.
on
(
'keyup blur'
,
function
()
{
function
validateRepassword
()
{
var
length
=
$repasswordInput
.
val
().
length
;
if
(
length
===
0
)
{
errTip
(
$repasswordInput
,
'请再次输入密码'
);
ep
.
emit
(
'repwd'
,
false
);
return
;
return
false
;
}
if
(
$passwordInput
.
val
()
!==
$repasswordInput
.
val
())
{
errTip
(
$repasswordInput
,
'两次输入的密码不一致,请重新输入'
);
ep
.
emit
(
'repwd'
,
false
);
return
;
return
false
;
}
ep
.
emit
(
'repwd'
,
true
);
hideTip
(
$repasswordInput
);
return
true
;
}
$repasswordInput
.
on
(
'blur'
,
function
()
{
validateRepassword
();
}).
on
(
'focus'
,
function
()
{
$repasswordInput
.
addClass
(
'focus'
);
hideTip
(
$repasswordInput
);
}).
on
(
'blur'
,
function
()
{
$repasswordInput
.
removeClass
(
'focus'
);
});
// 监听 repwd 事件
ep
.
on
(
'repwd'
,
function
(
repwdAuth
)
{
if
(
repwdAuth
)
{
hideTip
(
$repasswordInput
);
}
});
// 监听 pwd 事件
ep
.
on
(
'pwd'
,
function
(
pwdAuth
)
{
if
(
pwdAuth
)
{
hideTip
(
$passwordInput
);
$next
.
click
(
function
()
{
if
(
validatePassword
()
&&
validateRepassword
())
{
$
(
'#reset-pwd-form'
).
submit
();
}
});
});
\ No newline at end of file
...
...
Please
register
or
login
to post a comment