|
|
@@ -254,24 +254,28 @@ class User extends Api
|
|
|
|
|
|
public function reset_pwd()
|
|
|
{
|
|
|
+ $code = $this->request->post('code');
|
|
|
$mobile = $this->request->post('mobile');
|
|
|
$new_pwd = $this->request->post("new_pwd", '', null);
|
|
|
$confirm_pwd = $this->request->post("confirm_pwd", '', null);
|
|
|
$rule = [
|
|
|
+ 'code' => 'require',
|
|
|
'mobile' => 'require|regex:^1\d{10}$',
|
|
|
'new_pwd' => 'require|regex:\S{6,30}',
|
|
|
'confirm_pwd' => 'require|regex:\S{6,30}|confirm:new_pwd',
|
|
|
];
|
|
|
$msg = [
|
|
|
- 'mobile.mobile' => __('Mobile is incorrect'),
|
|
|
+
|
|
|
'new_pwd.confirm' => __('Password and confirm password don\'t match')
|
|
|
];
|
|
|
$data = [
|
|
|
+ 'code' => $code,
|
|
|
'mobile' => $mobile,
|
|
|
'new_pwd' => $new_pwd,
|
|
|
'confirm_pwd' => $confirm_pwd,
|
|
|
];
|
|
|
$field = [
|
|
|
+ 'code' => __('区号'),
|
|
|
'mobile' => __('手机号码'),
|
|
|
'new_pwd' => __('新资金密码'),
|
|
|
'confirm_pwd' => __('新密码')
|
|
|
@@ -281,12 +285,12 @@ class User extends Api
|
|
|
if (!$result) {
|
|
|
$this->error(__($validate->getError()));
|
|
|
}
|
|
|
- dump(111);die;
|
|
|
+
|
|
|
Db::startTrans();
|
|
|
try {
|
|
|
$salt = Random::alnum();
|
|
|
$new_password = $this->auth->getEncryptPassword($new_pwd, $salt);
|
|
|
- UserModel::where('mobile', $mobile)
|
|
|
+ UserModel::where('mobile', $mobile)->where('code', $code)
|
|
|
->update([
|
|
|
'login_pwd' => $new_password,
|
|
|
'salt' => $salt
|