From 1a53e7d8921eee7711ef28924aa473eaead60029 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=E8=B6=85?= <23939139@qq.com> Date: Tue, 6 Jul 2021 19:05:59 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DAPI=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=94=A8=E6=88=B7=E4=B8=AD=E5=BF=83=E5=85=B3=E9=97=AD=E6=97=A0?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/User.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index df4671315..0c6f8ee24 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -19,6 +19,11 @@ class User extends Api public function _initialize() { parent::_initialize(); + + if (!Config::get('fastadmin.usercenter')) { + $this->error(__('User center already closed')); + } + } /** -- Gitee From d6cc1b4ee7a4187d93118239d2e453f5a54d8fb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?King=E8=B6=85?= <23939139@qq.com> Date: Tue, 6 Jul 2021 19:09:06 +0800 Subject: [PATCH 2/2] =?UTF-8?q?API=E6=A8=A1=E5=9D=97=E7=94=A8=E6=88=B7?= =?UTF-8?q?=E4=B8=AD=E5=BF=83=E5=A2=9E=E5=8A=A0=E5=88=A4=E6=96=AD=E6=98=AF?= =?UTF-8?q?=E5=90=A6=E5=85=B3=E9=97=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- application/api/controller/User.php | 55 +++++++++++++++-------------- 1 file changed, 28 insertions(+), 27 deletions(-) diff --git a/application/api/controller/User.php b/application/api/controller/User.php index 0c6f8ee24..f9b0c88b0 100644 --- a/application/api/controller/User.php +++ b/application/api/controller/User.php @@ -6,6 +6,7 @@ use app\common\controller\Api; use app\common\library\Ems; use app\common\library\Sms; use fast\Random; +use think\Config; use think\Validate; /** @@ -43,7 +44,7 @@ class User extends Api */ public function login() { - $account = $this->request->post('account'); + $account = $this->request->post('account'); $password = $this->request->post('password'); if (!$account || !$password) { $this->error(__('Invalid parameters')); @@ -66,7 +67,7 @@ class User extends Api */ public function mobilelogin() { - $mobile = $this->request->post('mobile'); + $mobile = $this->request->post('mobile'); $captcha = $this->request->post('captcha'); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); @@ -110,9 +111,9 @@ class User extends Api { $username = $this->request->post('username'); $password = $this->request->post('password'); - $email = $this->request->post('email'); - $mobile = $this->request->post('mobile'); - $code = $this->request->post('code'); + $email = $this->request->post('email'); + $mobile = $this->request->post('mobile'); + $code = $this->request->post('code'); if (!$username || !$password) { $this->error(__('Invalid parameters')); } @@ -155,11 +156,11 @@ class User extends Api */ public function profile() { - $user = $this->auth->getUser(); + $user = $this->auth->getUser(); $username = $this->request->post('username'); $nickname = $this->request->post('nickname'); - $bio = $this->request->post('bio'); - $avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars'); + $bio = $this->request->post('bio'); + $avatar = $this->request->post('avatar', '', 'trim,strip_tags,htmlspecialchars'); if ($username) { $exists = \app\common\model\User::where('username', $username)->where('id', '<>', $this->auth->id)->find(); if ($exists) { @@ -174,7 +175,7 @@ class User extends Api } $user->nickname = $nickname; } - $user->bio = $bio; + $user->bio = $bio; $user->avatar = $avatar; $user->save(); $this->success(); @@ -189,8 +190,8 @@ class User extends Api */ public function changeemail() { - $user = $this->auth->getUser(); - $email = $this->request->post('email'); + $user = $this->auth->getUser(); + $email = $this->request->post('email'); $captcha = $this->request->post('captcha'); if (!$email || !$captcha) { $this->error(__('Invalid parameters')); @@ -205,10 +206,10 @@ class User extends Api if (!$result) { $this->error(__('Captcha is incorrect')); } - $verification = $user->verification; + $verification = $user->verification; $verification->email = 1; - $user->verification = $verification; - $user->email = $email; + $user->verification = $verification; + $user->email = $email; $user->save(); Ems::flush($email, 'changeemail'); @@ -224,8 +225,8 @@ class User extends Api */ public function changemobile() { - $user = $this->auth->getUser(); - $mobile = $this->request->post('mobile'); + $user = $this->auth->getUser(); + $mobile = $this->request->post('mobile'); $captcha = $this->request->post('captcha'); if (!$mobile || !$captcha) { $this->error(__('Invalid parameters')); @@ -240,10 +241,10 @@ class User extends Api if (!$result) { $this->error(__('Captcha is incorrect')); } - $verification = $user->verification; + $verification = $user->verification; $verification->mobile = 1; - $user->verification = $verification; - $user->mobile = $mobile; + $user->verification = $verification; + $user->mobile = $mobile; $user->save(); Sms::flush($mobile, 'changemobile'); @@ -259,10 +260,10 @@ class User extends Api */ public function third() { - $url = url('user/index'); + $url = url('user/index'); $platform = $this->request->post("platform"); - $code = $this->request->post("code"); - $config = get_addon_config('third'); + $code = $this->request->post("code"); + $config = get_addon_config('third'); if (!$config || !isset($config[$platform])) { $this->error(__('Invalid parameters')); } @@ -274,7 +275,7 @@ class User extends Api if ($loginret) { $data = [ 'userinfo' => $this->auth->getUserinfo(), - 'thirdinfo' => $result + 'thirdinfo' => $result, ]; $this->success(__('Logged in successful'), $data); } @@ -292,11 +293,11 @@ class User extends Api */ public function resetpwd() { - $type = $this->request->post("type"); - $mobile = $this->request->post("mobile"); - $email = $this->request->post("email"); + $type = $this->request->post("type"); + $mobile = $this->request->post("mobile"); + $email = $this->request->post("email"); $newpassword = $this->request->post("newpassword"); - $captcha = $this->request->post("captcha"); + $captcha = $this->request->post("captcha"); if (!$newpassword || !$captcha) { $this->error(__('Invalid parameters')); } -- Gitee