songxingwei 3 years ago
parent
commit
7bc4b40882
1 changed files with 5 additions and 1 deletions
  1. 5 1
      application/api/controller/Login.php

+ 5 - 1
application/api/controller/Login.php

@@ -67,7 +67,6 @@ class Login extends Api
      *
      *
      * @return name:token type:string desc:token
-
      */
     public function login(){
         $phone = input('phone');  //手机号
@@ -106,11 +105,13 @@ class Login extends Api
      * @param  name:phone type:string require:1 desc:手机号
      * @param  name:password type:string require:0 desc:密码
      * @param  name:ver_code type:string require:0 desc:验证码
+     * @param  name:confirm_password type:string require:1 desc:确认密码
      *
      */
     public function forgot_password(){
         $phone = input('phone');  //手机号
         $password = input('password');    //密码
+        $confirm_password = input('confirm_password');    //确认密码
         $ver_code = input('ver_code');    //验证码
         if (!$phone || !$password){
             $this->error('参数错误');
@@ -118,6 +119,9 @@ class Login extends Api
         if (!$phone || !Validate::regex($phone, "^1\d{10}$")) {
             $this->error('手机号格式错误');
         }
+        if ($password!=$confirm_password){
+            $this->error('密码与确认密码不一致');
+        }
         $result = User::forgotPassword($phone,$password,$ver_code);
         if ($result['code']){
             $this->success($result['msg'],$result['data']);