|
@@ -362,7 +362,25 @@ class User extends Api
|
|
|
|
|
|
$this->success('',$info);
|
|
|
}
|
|
|
-
|
|
|
+ /**
|
|
|
+ * 密码方式修改密码
|
|
|
+ * @ApiParams (name=old_pwd,description=旧密码)
|
|
|
+ * @ApiParams (name=new_pwd,description=旧密码)
|
|
|
+ * @ApiParams (name=new_pwd_confirm,description=旧密码确认密码)
|
|
|
+ */
|
|
|
+ public function changepwd(){
|
|
|
+ $user=$this->auth->getUser();
|
|
|
+ $data=$this->_validate([
|
|
|
+ 'old_pwd|旧密码'=>['require','min:6'],
|
|
|
+ 'new_pwd|新密码'=>['require','min:6'],
|
|
|
+ 'new_pwd_confirm|确认新密码'=>['require','min:6','confirm:new_pwd'],
|
|
|
+ ]);
|
|
|
+ if ($user->password != $this->auth->getEncryptPassword($data['old_pwd'], $user->salt)) {
|
|
|
+ $this->error('密码错误');
|
|
|
+ }
|
|
|
+ $this->auth->changepwd($data['new_pwd']);
|
|
|
+ $this->success();
|
|
|
+ }
|
|
|
/**
|
|
|
* 重置密码
|
|
|
*
|