Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Z
zuiketang
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
zuiketang
Commits
77b7aa25
Commit
77b7aa25
authored
Oct 20, 2016
by
xiabin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改找回密码的严重问题
parent
3b38a40b
Changes
10
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
186 additions
and
245 deletions
+186
-245
SiteController.php
src/frontend/controllers/SiteController.php
+127
-138
PasswordResetRequestForm.php
src/frontend/models/PasswordResetRequestForm.php
+12
-1
ResetPasswordForm.php
src/frontend/models/ResetPasswordForm.php
+1
-1
SignupForm.php
src/frontend/models/SignupForm.php
+1
-1
TokenInputForm.php
src/frontend/models/TokenInputForm.php
+16
-1
requestPasswordResetToken.php
src/frontend/views/site/requestPasswordResetToken.php
+11
-5
resetPassword.php
src/frontend/views/site/resetPassword.php
+6
-19
tokenInput.php
src/frontend/views/site/tokenInput.php
+10
-5
request_password_reset.js
src/frontend/web/js/site/request_password_reset.js
+1
-38
token_input.js
src/frontend/web/js/site/token_input.js
+1
-36
No files found.
src/frontend/controllers/SiteController.php
View file @
77b7aa25
This diff is collapsed.
Click to expand it.
src/frontend/models/PasswordResetRequestForm.php
View file @
77b7aa25
...
@@ -17,6 +17,7 @@ class PasswordResetRequestForm extends Model
...
@@ -17,6 +17,7 @@ class PasswordResetRequestForm extends Model
public
$telephone
;
public
$telephone
;
public
$verifyCode
;
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
@@ -30,11 +31,21 @@ class PasswordResetRequestForm extends Model
...
@@ -30,11 +31,21 @@ class PasswordResetRequestForm extends Model
'filter'
=>
[
'status'
=>
User
::
STATUS_ACTIVE
],
'filter'
=>
[
'status'
=>
User
::
STATUS_ACTIVE
],
'message'
=>
'There is no user with such telephone.'
'message'
=>
'There is no user with such telephone.'
],
],
[
'verifyCode'
,
'required'
],
[
'verifyCode'
,
'captcha'
]
];
];
}
}
/**
* @inheritdoc
*/
public
function
attributeLabels
()
{
return
[
'verifyCode'
=>
''
];
}
public
function
sendMsg
()
public
function
sendMsg
()
{
{
...
...
src/frontend/models/ResetPasswordForm.php
View file @
77b7aa25
...
@@ -45,7 +45,7 @@ class ResetPasswordForm extends Model
...
@@ -45,7 +45,7 @@ class ResetPasswordForm extends Model
[
'password'
,
'required'
],
[
'password'
,
'required'
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'compare'
,
'compareAttribute'
=>
'
rePassword
'
],
[
'rePassword'
,
'compare'
,
'compareAttribute'
=>
'
password'
,
'message'
=>
'两次密码输入不一致
'
],
];
];
}
}
...
...
src/frontend/models/SignupForm.php
View file @
77b7aa25
...
@@ -35,7 +35,7 @@ class SignupForm extends Model
...
@@ -35,7 +35,7 @@ class SignupForm extends Model
[[
'password'
,
'rePassword'
],
'required'
],
[[
'password'
,
'rePassword'
],
'required'
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'password'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'string'
,
'min'
=>
6
],
[
'rePassword'
,
'compare'
,
'compareAttribute'
=>
'
reP
assword'
],
[
'rePassword'
,
'compare'
,
'compareAttribute'
=>
'
p
assword'
],
[
'from'
,
'integer'
],
[
'from'
,
'integer'
],
[
'verifyCode'
,
'required'
],
[
'verifyCode'
,
'required'
],
[
'verifyCode'
,
'captcha'
]
[
'verifyCode'
,
'captcha'
]
...
...
src/frontend/models/TokenInputForm.php
View file @
77b7aa25
...
@@ -21,6 +21,7 @@ class TokenInputForm extends Model
...
@@ -21,6 +21,7 @@ class TokenInputForm extends Model
{
{
public
$token
;
public
$token
;
public
$verifyCode
;
/**
/**
* @return array
* @return array
*/
*/
...
@@ -29,10 +30,24 @@ class TokenInputForm extends Model
...
@@ -29,10 +30,24 @@ class TokenInputForm extends Model
return
[
return
[
[
'token'
,
'trim'
],
[
'token'
,
'trim'
],
[
'token'
,
'required'
],
[
'token'
,
'required'
],
[
'token'
,
'string'
]
[
'token'
,
'string'
],
[
'verifyCode'
,
'required'
],
[
'verifyCode'
,
'captcha'
]
];
];
}
}
/**
* @inheritdoc
*/
public
function
attributeLabels
()
{
return
[
'verifyCode'
=>
''
];
}
/**
/**
* @inheritdoc
* @inheritdoc
*/
*/
...
...
src/frontend/views/site/requestPasswordResetToken.php
View file @
77b7aa25
...
@@ -5,6 +5,7 @@
...
@@ -5,6 +5,7 @@
/* @var $model \frontend\models\PasswordResetRequestForm */
/* @var $model \frontend\models\PasswordResetRequestForm */
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
use
yii\captcha\Captcha
;
$this
->
title
=
'找回密码'
;
$this
->
title
=
'找回密码'
;
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/request_password_reset.js'
);
\frontend\assets\AppAsset
::
addScript
(
$this
,
'@web/assets/request_password_reset.js'
);
...
@@ -36,15 +37,20 @@ $this->registerJsFile('http://static.geetest.com/static/tools/gt.js');
...
@@ -36,15 +37,20 @@ $this->registerJsFile('http://static.geetest.com/static/tools/gt.js');
<input
name=
"telephone"
type=
"text"
class=
""
placeholder=
"请输入注册的手机号码"
required=
""
autofocus=
""
>
<input
name=
"telephone"
type=
"text"
class=
""
placeholder=
"请输入注册的手机号码"
required=
""
autofocus=
""
>
<!--<span class="tips">手机号或者密码错误</span>-->
<!--<span class="tips">手机号或者密码错误</span>-->
</div>
</div>
<div
class=
"password input-wrapper last-wrapper"
"
>
<?=
$form
->
field
(
$model
,
'verifyCode'
)
->
widget
(
Captcha
::
className
(),[
'template'
=>
"
{
image
}
"
,
'imageOptions'
=>
[
'alt'
=>
'验证码'
],
'captchaAction'
=>
'site/captcha'
,
])
->
error
(
FALSE
);
?>
<input
id=
"verifyCode"
name=
"verifyCode"
type=
"text"
placeholder=
"输入验证码"
required=
""
>
<span
id=
"verifyCode"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'verifyCode'
)
?>
</span>
</div>
</div>
<div
class=
"v-geetest"
>
<div
id=
"embed-captcha"
></div>
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<div
class=
"foot-reg-btn"
>
<button
id=
"submit"
class=
"btn btn-log"
type=
"submit"
>
获取验证码
</button>
<button
id=
"submit"
class=
"btn btn-log"
type=
"submit"
>
获取验证码
</button>
</div>
</div>
...
...
src/frontend/views/site/resetPassword.php
View file @
77b7aa25
...
@@ -8,20 +8,6 @@ use yii\helpers\Html;
...
@@ -8,20 +8,6 @@ use yii\helpers\Html;
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
$this
->
title
=
'Reset password'
;
$this
->
title
=
'Reset password'
;
$jsString
=
<<<JS
$("#submit").unbind().click(function() {
console.log($("#password").val());
console.log($("#repassword").val());
if($("#password").val() != $("#repassword").val()){
$("#repassword_tips").html('两次密码不一致');
return false;
}
});
JS;
$this
->
registerJs
(
$jsString
);
?>
?>
<div
class=
"container"
>
<div
class=
"container"
>
<div
class=
"z-m-center"
>
<div
class=
"z-m-center"
>
...
@@ -41,20 +27,21 @@ $this->registerJs($jsString);
...
@@ -41,20 +27,21 @@ $this->registerJs($jsString);
<div
class=
"tab-pane fade in active"
id=
"three"
>
<div
class=
"tab-pane fade in active"
id=
"three"
>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<?php
$form
=
ActiveForm
::
begin
([
'id'
=>
'request-password-reset-form'
]);
?>
<div
class=
"reg-box"
>
<div
class=
"reg-box"
>
<div
class=
"password input-wrapper"
>
<div
class=
"password input-wrapper"
>
<input
value=
"
<?=
$model
->
password
?>
"
id=
"password"
name=
"password"
type=
"password"
class=
""
<input
value=
"
<?=
$model
->
password
?>
"
id=
"password"
name=
"password"
type=
"password"
class=
""
placeholder=
"设置新密码"
required=
""
>
placeholder=
"设置新密码"
>
<span
id=
"repassword_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'password'
)
?>
</span>
</div>
</div>
<div
class=
"check-password input-wrapper
last-wrapper
"
>
<div
class=
"check-password input-wrapper"
>
<input
value=
"
<?=
$model
->
rePassword
?>
"
id=
"repassword"
name=
"rePassword"
type=
"password"
class=
""
placeholder=
"重复输入密码"
required=
""
>
<input
value=
"
<?=
$model
->
rePassword
?>
"
id=
"repassword"
name=
"rePassword"
type=
"password"
class=
""
placeholder=
"重复输入密码"
>
<span
id=
"repassword_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'rePassword'
)
?>
</span>
<span
id=
"repassword_tips"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'rePassword'
)
?>
</span>
</div>
</div>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<div
class=
"foot-reg-btn"
>
<button
id=
"submit"
class=
"btn btn-log"
type=
"submit"
>
确认
</button>
<button
class=
"btn btn-log"
type=
"submit"
>
确认
</button>
</div>
</div>
<?php
ActiveForm
::
end
()
?>
<?php
ActiveForm
::
end
()
?>
</div>
</div>
...
...
src/frontend/views/site/tokenInput.php
View file @
77b7aa25
...
@@ -7,6 +7,7 @@
...
@@ -7,6 +7,7 @@
*/
*/
use
yii\captcha\Captcha
;
use
yii\helpers\Html
;
use
yii\helpers\Html
;
use
yii\bootstrap\ActiveForm
;
use
yii\bootstrap\ActiveForm
;
...
@@ -40,11 +41,15 @@ $this->registerJsFile('http://static.geetest.com/static/tools/gt.js');
...
@@ -40,11 +41,15 @@ $this->registerJsFile('http://static.geetest.com/static/tools/gt.js');
<input
name=
"token"
type=
"text"
class=
""
value=
"
<?=
$model
->
token
?>
"
placeholder=
"请输入6位验证码"
required=
""
autofocus=
""
>
<input
name=
"token"
type=
"text"
class=
""
value=
"
<?=
$model
->
token
?>
"
placeholder=
"请输入6位验证码"
required=
""
autofocus=
""
>
<span
class=
"tips"
>
<?=
$model
->
getFirstError
(
'token'
)
?>
</span>
<span
class=
"tips"
>
<?=
$model
->
getFirstError
(
'token'
)
?>
</span>
</div>
</div>
<div
style=
"margin-top: 20px;margin-bottom: 20px"
>
<div
class=
"password input-wrapper last-wrapper"
"
>
<div
id=
"embed-captcha"
></div>
<?=
$form
->
field
(
$model
,
'verifyCode'
)
->
widget
(
Captcha
::
className
(),[
<p
id=
"wait"
class=
"show"
>
正在加载验证码......
</p>
'template'
=>
"
{
image
}
"
,
<p
id=
"notice"
class=
"hide"
>
请先拖动验证码到相应位置
</p>
'imageOptions'
=>
[
'alt'
=>
'验证码'
],
</div>
'captchaAction'
=>
'site/captcha'
,
])
->
error
(
FALSE
);
?>
<input
id=
"verifyCode"
name=
"verifyCode"
type=
"text"
placeholder=
"输入验证码"
required=
""
>
<span
id=
"verifyCode"
class=
"tips"
>
<?=
$model
->
getFirstError
(
'verifyCode'
)
?>
</span>
</div>
</div>
</div>
<div
class=
"foot-reg-btn"
>
<div
class=
"foot-reg-btn"
>
<button
id=
"token_input"
class=
"btn btn-log"
type=
"submit"
>
下一步
</button>
<button
id=
"token_input"
class=
"btn btn-log"
type=
"submit"
>
下一步
</button>
...
...
src/frontend/web/js/site/request_password_reset.js
View file @
77b7aa25
/**
/**
* Created by xiabin on 2016/9/26.
* Created by xiabin on 2016/9/26.
*/
*/
var
handlerEmbed
=
function
(
captchaObj
)
{
$
(
"#submit"
).
unbind
().
click
(
function
(
e
)
{
var
validate
=
captchaObj
.
getValidate
();
if
(
!
validate
)
{
$
(
"#notice"
)[
0
].
className
=
"show"
;
setTimeout
(
function
()
{
$
(
"#notice"
)[
0
].
className
=
"hide"
;
},
2000
);
return
false
;
}
else
{
$
(
"#request-password-reset-form"
).
submit
();
}
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
captchaObj
.
appendTo
(
"#embed-captcha"
);
captchaObj
.
onReady
(
function
()
{
$
(
"#wait"
)[
0
].
className
=
"hide"
;
});
// 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
};
$
.
ajax
({
// 获取id,challenge,success(是否启用failback)
url
:
__BASE_URL__
+
"site/start-captcha?type=pc&t="
+
(
new
Date
()).
getTime
(),
// 加随机数防止缓存
type
:
"get"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
// 使用initGeetest接口
// 参数1:配置参数
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
initGeetest
({
gt
:
data
.
gt
,
challenge
:
data
.
challenge
,
product
:
"float"
,
// 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
offline
:
!
data
.
success
// 表示用户后台检测极验服务器是否宕机,一般不需要关注
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
},
handlerEmbed
);
}
});
src/frontend/web/js/site/token_input.js
View file @
77b7aa25
...
@@ -4,41 +4,6 @@
...
@@ -4,41 +4,6 @@
/**
/**
* Created by xiabin on 2016/9/26.
* Created by xiabin on 2016/9/26.
*/
*/
var
handlerEmbed
=
function
(
captchaObj
)
{
$
(
"#token_input"
).
click
(
function
()
{
var
validate
=
captchaObj
.
getValidate
();
if
(
!
validate
)
{
$
(
"#notice"
)[
0
].
className
=
"show"
;
setTimeout
(
function
()
{
$
(
"#notice"
)[
0
].
className
=
"hide"
;
},
2000
);
return
false
;
}
});
// 将验证码加到id为captcha的元素里,同时会有三个input的值:geetest_challenge, geetest_validate, geetest_seccode
captchaObj
.
appendTo
(
"#embed-captcha"
);
captchaObj
.
onReady
(
function
()
{
$
(
"#wait"
)[
0
].
className
=
"hide"
;
});
// 更多接口参考:http://www.geetest.com/install/sections/idx-client-sdk.html
};
$
.
ajax
({
// 获取id,challenge,success(是否启用failback)
url
:
__BASE_URL__
+
"site/start-captcha?type=pc&t="
+
(
new
Date
()).
getTime
(),
// 加随机数防止缓存
type
:
"get"
,
dataType
:
"json"
,
success
:
function
(
data
)
{
// 使用initGeetest接口
// 参数1:配置参数
// 参数2:回调,回调的第一个参数验证码对象,之后可以使用它做appendTo之类的事件
initGeetest
({
gt
:
data
.
gt
,
challenge
:
data
.
challenge
,
product
:
"float"
,
// 产品形式,包括:float,embed,popup。注意只对PC版验证码有效
offline
:
!
data
.
success
// 表示用户后台检测极验服务器是否宕机,一般不需要关注
// 更多配置参数请参见:http://www.geetest.com/install/sections/idx-client-sdk.html#config
},
handlerEmbed
);
}
});
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment