|
@@ -37,8 +37,8 @@ class User extends Api
|
|
*/
|
|
*/
|
|
public function login()
|
|
public function login()
|
|
{
|
|
{
|
|
- $account = $this->request->post('account');
|
|
|
|
- $password = $this->request->post('password');
|
|
|
|
|
|
+ $account = input('account');
|
|
|
|
+ $password = input('password');
|
|
if (!$account || !$password) {
|
|
if (!$account || !$password) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -60,8 +60,8 @@ class User extends Api
|
|
*/
|
|
*/
|
|
public function mobilelogin()
|
|
public function mobilelogin()
|
|
{
|
|
{
|
|
- $mobile = $this->request->post('mobile');
|
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
|
|
|
+ $mobile = input('mobile');
|
|
|
|
+ $captcha = input('captcha');
|
|
if (!$mobile || !$captcha) {
|
|
if (!$mobile || !$captcha) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -102,9 +102,9 @@ class User extends Api
|
|
*/
|
|
*/
|
|
public function register()
|
|
public function register()
|
|
{
|
|
{
|
|
- $mobile = $this->request->post('mobile');
|
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
|
- $password = $this->request->post('password');
|
|
|
|
|
|
+ $mobile = input('mobile');
|
|
|
|
+ $captcha = input('captcha');
|
|
|
|
+ $password = input('password');
|
|
|
|
|
|
if (!$mobile || !$captcha || !$password) {
|
|
if (!$mobile || !$captcha || !$password) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
@@ -127,7 +127,7 @@ class User extends Api
|
|
|
|
|
|
//微信登录,预先假注册
|
|
//微信登录,预先假注册
|
|
public function wechatlogin(){
|
|
public function wechatlogin(){
|
|
- $code = $this->request->param('code','');
|
|
|
|
|
|
+ $code = input('code','');
|
|
if(!$code){
|
|
if(!$code){
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -197,9 +197,9 @@ class User extends Api
|
|
public function bindmobile()
|
|
public function bindmobile()
|
|
{
|
|
{
|
|
|
|
|
|
- $mobile = $this->request->param('mobile');
|
|
|
|
- $captcha = $this->request->param('captcha');
|
|
|
|
- $code = $this->request->param('code');
|
|
|
|
|
|
+ $mobile = input('mobile');
|
|
|
|
+ $captcha = input('captcha');
|
|
|
|
+ $code = input('code');
|
|
|
|
|
|
if (!$mobile || !$captcha || !$code) {
|
|
if (!$mobile || !$captcha || !$code) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
@@ -231,7 +231,7 @@ class User extends Api
|
|
}
|
|
}
|
|
//如果已经有账号则直接登录
|
|
//如果已经有账号则直接登录
|
|
$ret = $this->auth->direct($user['id']);
|
|
$ret = $this->auth->direct($user['id']);
|
|
- $this->success('success',$this->auth->getUserinfo_simple());
|
|
|
|
|
|
+ $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
|
|
}
|
|
}
|
|
|
|
|
|
//新的openid用户
|
|
//新的openid用户
|
|
@@ -250,7 +250,6 @@ class User extends Api
|
|
} else {
|
|
} else {
|
|
$extend = [
|
|
$extend = [
|
|
'wechat_openid' => $wechatCode['openid'],
|
|
'wechat_openid' => $wechatCode['openid'],
|
|
-// 'plat_unique_id' => input('plat_unique_id','','trim'),
|
|
|
|
];
|
|
];
|
|
$ret = $this->auth->register('', '','', $mobile, $extend);
|
|
$ret = $this->auth->register('', '','', $mobile, $extend);
|
|
}
|
|
}
|
|
@@ -258,7 +257,7 @@ class User extends Api
|
|
$this->error($this->auth->getError());
|
|
$this->error($this->auth->getError());
|
|
}
|
|
}
|
|
|
|
|
|
- $this->success('success',$this->auth->getUserinfo_simple());
|
|
|
|
|
|
+ $this->success(__('Logged in successful'), $this->auth->getUserinfo_simple());
|
|
|
|
|
|
}
|
|
}
|
|
|
|
|
|
@@ -361,8 +360,8 @@ class User extends Api
|
|
{
|
|
{
|
|
$user = $this->auth->getUser();
|
|
$user = $this->auth->getUser();
|
|
|
|
|
|
- $mobile = $this->request->post('mobile');
|
|
|
|
- $captcha = $this->request->post('captcha');
|
|
|
|
|
|
+ $mobile = input('mobile');
|
|
|
|
+ $captcha = input('captcha');
|
|
if (!$mobile || !$captcha) {
|
|
if (!$mobile || !$captcha) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|
|
}
|
|
}
|
|
@@ -388,7 +387,7 @@ class User extends Api
|
|
public function changepwd()
|
|
public function changepwd()
|
|
{
|
|
{
|
|
$mobile = $this->auth->mobile;
|
|
$mobile = $this->auth->mobile;
|
|
- $captcha = $this->request->post('captcha');
|
|
|
|
|
|
+ $captcha = input('captcha');
|
|
$newpassword = input('newpassword','');
|
|
$newpassword = input('newpassword','');
|
|
|
|
|
|
if (!$mobile || !$captcha || !$newpassword) {
|
|
if (!$mobile || !$captcha || !$newpassword) {
|
|
@@ -425,9 +424,9 @@ class User extends Api
|
|
*/
|
|
*/
|
|
public function resetpwd()
|
|
public function resetpwd()
|
|
{
|
|
{
|
|
- $mobile = $this->request->post("mobile");
|
|
|
|
- $captcha = $this->request->post("captcha");
|
|
|
|
- $newpassword = $this->request->post("newpassword");
|
|
|
|
|
|
+ $mobile = input("mobile");
|
|
|
|
+ $captcha = input("captcha");
|
|
|
|
+ $newpassword = input("newpassword");
|
|
|
|
|
|
if (!$mobile || !$captcha || !$newpassword) {
|
|
if (!$mobile || !$captcha || !$newpassword) {
|
|
$this->error(__('Invalid parameters'));
|
|
$this->error(__('Invalid parameters'));
|