|
@@ -15,7 +15,7 @@ use app\common\library\Wechat;
|
|
|
*/
|
|
|
class User extends Apiw
|
|
|
{
|
|
|
- protected $noNeedLogin = ['login'];
|
|
|
+ protected $noNeedLogin = ['login','resetpwd'];
|
|
|
protected $noNeedRight = '*';
|
|
|
|
|
|
|
|
@@ -53,7 +53,7 @@ class User extends Apiw
|
|
|
* @param string $captcha 验证码
|
|
|
* @param string $newpassword 新密码
|
|
|
*/
|
|
|
- /*public function resetpwd()
|
|
|
+ public function resetpwd()
|
|
|
{
|
|
|
$mobile = $this->request->post('mobile');
|
|
|
$captcha = $this->request->post('captcha');
|
|
@@ -68,7 +68,7 @@ class User extends Apiw
|
|
|
if (!Validate::regex($mobile, "^1\d{10}$")) {
|
|
|
$this->error(__('Mobile is incorrect'));
|
|
|
}
|
|
|
- $user = \app\common\model\CompanyStaff::getByMobile($mobile);
|
|
|
+ $user = \app\common\model\Worker::getByMobile($mobile);
|
|
|
if (!$user) {
|
|
|
$this->error(__('User not found'));
|
|
|
}
|
|
@@ -80,13 +80,13 @@ class User extends Apiw
|
|
|
|
|
|
//模拟一次登录
|
|
|
$this->auth->direct($user->id);
|
|
|
- $ret = $this->auth->resetpwd($newpassword, '', true);
|
|
|
+ $ret = $this->auth->changepwd($newpassword, '', true);
|
|
|
if ($ret) {
|
|
|
$this->success(__('Reset password successful'));
|
|
|
} else {
|
|
|
$this->error($this->auth->getError());
|
|
|
}
|
|
|
- }*/
|
|
|
+ }
|
|
|
|
|
|
|
|
|
/**
|