|
@@ -6,7 +6,7 @@ use app\common\controller\Api;
|
|
|
use app\common\library\Ems;
|
|
use app\common\library\Ems;
|
|
|
use app\common\library\Sms;
|
|
use app\common\library\Sms;
|
|
|
use app\common\model\Order as OrderModel;
|
|
use app\common\model\Order as OrderModel;
|
|
|
-use app\common\model\User as UserModel;
|
|
|
|
|
|
|
+use app\common\model\Users as UserModel;
|
|
|
use fast\Random;
|
|
use fast\Random;
|
|
|
use think\Cache;
|
|
use think\Cache;
|
|
|
use think\Config;
|
|
use think\Config;
|
|
@@ -194,7 +194,7 @@ class User extends Api
|
|
|
$this->error(__('Captcha is incorrect'));
|
|
$this->error(__('Captcha is incorrect'));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- $res = (new \app\common\model\User())
|
|
|
|
|
|
|
+ $res = (new \app\common\model\Users())
|
|
|
->where('id', $user['id'])
|
|
->where('id', $user['id'])
|
|
|
->update([
|
|
->update([
|
|
|
'fund_pwd' => md5($new_pwd)
|
|
'fund_pwd' => md5($new_pwd)
|
|
@@ -216,8 +216,9 @@ class User extends Api
|
|
|
$code = $this->request->post('country_code');
|
|
$code = $this->request->post('country_code');
|
|
|
$mobile = $this->request->post('mobile');
|
|
$mobile = $this->request->post('mobile');
|
|
|
$captcha = $this->request->post('captcha');
|
|
$captcha = $this->request->post('captcha');
|
|
|
|
|
+ $token = $this->request->post('token');
|
|
|
|
|
|
|
|
- if(!captcha_check($captcha)){
|
|
|
|
|
|
|
+ if(!captcha_check($captcha,$token)){
|
|
|
$this->error(__('验证码错误'));
|
|
$this->error(__('验证码错误'));
|
|
|
};
|
|
};
|
|
|
|
|
|
|
@@ -318,7 +319,7 @@ class User extends Api
|
|
|
if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
if (!Sms::check($mobile, $captcha, 'mobilelogin')) {
|
|
|
$this->error(__('Captcha is incorrect'));
|
|
$this->error(__('Captcha is incorrect'));
|
|
|
}
|
|
}
|
|
|
- $user = \app\common\model\User::getByMobile($mobile);
|
|
|
|
|
|
|
+ $user = \app\common\model\Users::getByMobile($mobile);
|
|
|
if ($user) {
|
|
if ($user) {
|
|
|
if ($user->status != 'normal') {
|
|
if ($user->status != 'normal') {
|
|
|
$this->error(__('Account is locked'));
|
|
$this->error(__('Account is locked'));
|
|
@@ -413,14 +414,14 @@ class User extends Api
|
|
|
$bio = $this->request->post('bio');
|
|
$bio = $this->request->post('bio');
|
|
|
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
|
|
$avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars');
|
|
|
if ($username) {
|
|
if ($username) {
|
|
|
- $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find();
|
|
|
|
|
|
|
+ $exists = \app\common\model\Users::where('username', $username)->where('id', '<>', $this->auth->id)->find();
|
|
|
if ($exists) {
|
|
if ($exists) {
|
|
|
$this->error(__('Username already exists'));
|
|
$this->error(__('Username already exists'));
|
|
|
}
|
|
}
|
|
|
$user->username = $username;
|
|
$user->username = $username;
|
|
|
}
|
|
}
|
|
|
if ($nickname) {
|
|
if ($nickname) {
|
|
|
- $exists = \app\common\model\User::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
|
|
|
|
|
|
|
+ $exists = \app\common\model\Users::where('nickname', $nickname)->where('id', '<>', $this->auth->id)->find();
|
|
|
if ($exists) {
|
|
if ($exists) {
|
|
|
$this->error(__('Nickname already exists'));
|
|
$this->error(__('Nickname already exists'));
|
|
|
}
|
|
}
|
|
@@ -450,7 +451,7 @@ class User extends Api
|
|
|
if (!Validate::is($email, "email")) {
|
|
if (!Validate::is($email, "email")) {
|
|
|
$this->error(__('Email is incorrect'));
|
|
$this->error(__('Email is incorrect'));
|
|
|
}
|
|
}
|
|
|
- if (\app\common\model\User::where('email', $email)->where('id', '<>', $user->id)->find()) {
|
|
|
|
|
|
|
+ if (\app\common\model\Users::where('email', $email)->where('id', '<>', $user->id)->find()) {
|
|
|
$this->error(__('Email already exists'));
|
|
$this->error(__('Email already exists'));
|
|
|
}
|
|
}
|
|
|
$result = Ems::check($email, $captcha, 'changeemail');
|
|
$result = Ems::check($email, $captcha, 'changeemail');
|
|
@@ -485,7 +486,7 @@ class User extends Api
|
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
}
|
|
|
- if (\app\common\model\User::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) {
|
|
|
|
|
|
|
+ if (\app\common\model\Users::where('mobile', $mobile)->where('id', '<>', $user->id)->find()) {
|
|
|
$this->error(__('Mobile already exists'));
|
|
$this->error(__('Mobile already exists'));
|
|
|
}
|
|
}
|
|
|
$result = Sms::check($mobile, $captcha, 'changemobile');
|
|
$result = Sms::check($mobile, $captcha, 'changemobile');
|
|
@@ -560,7 +561,7 @@ class User extends Api
|
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
}
|
|
|
- $user = \app\common\model\User::getByMobile($mobile);
|
|
|
|
|
|
|
+ $user = \app\common\model\Users::getByMobile($mobile);
|
|
|
if (!$user) {
|
|
if (!$user) {
|
|
|
$this->error(__('User not found'));
|
|
$this->error(__('User not found'));
|
|
|
}
|
|
}
|
|
@@ -573,7 +574,7 @@ class User extends Api
|
|
|
if (!Validate::is($email, "email")) {
|
|
if (!Validate::is($email, "email")) {
|
|
|
$this->error(__('Email is incorrect'));
|
|
$this->error(__('Email is incorrect'));
|
|
|
}
|
|
}
|
|
|
- $user = \app\common\model\User::getByEmail($email);
|
|
|
|
|
|
|
+ $user = \app\common\model\Users::getByEmail($email);
|
|
|
if (!$user) {
|
|
if (!$user) {
|
|
|
$this->error(__('User not found'));
|
|
$this->error(__('User not found'));
|
|
|
}
|
|
}
|