天天看點

YYC松鼠短視訊系統【bug】短信驗證碼功能bug,新注冊短信使用者任意填寫驗證碼都能通過注冊的嚴重bug修複

【bug】短信驗證碼功能bug,新注冊短信使用者任意填寫驗證碼都能通過注冊的嚴重bug

之前有處理驗證bug是針對的郵箱注冊,目前發現短信注冊存在bug,已經手機注冊的使用者短信登入無bug,新手機使用者注冊有bug。

修改内容:

修改檔案/songshu-video-back/application/api/controller/User.php

将此段代碼 放在

YYC松鼠短視訊系統【bug】短信驗證碼功能bug,新注冊短信使用者任意填寫驗證碼都能通過注冊的嚴重bug修複
此段代碼紅色位置部分
YYC松鼠短視訊系統【bug】短信驗證碼功能bug,新注冊短信使用者任意填寫驗證碼都能通過注冊的嚴重bug修複
最終效果:

}
            $token = pass($username . time() . getRandStr()) . $username;
            Db("user")->where(['id' => $user['id']])->update(["token" => $token]);
            session("user", $user);
            unset($user['password']);
            return success("登入成功", $user);
            break;
        case "phone"://手機驗證碼登入
            $phone = input("phone/i");//手機号
            $user = Db("user")->where(['phone' => $phone])->find();
            $code = input("code/i");
                           
                           
                            //判斷短信驗證碼是否正确
                            if (!Sms::verifySms($phone, $code)) {
                                u_log("手機使用者" . $phone . "登入失敗", 'error');
                                return error("驗證碼錯誤");
                            }
                           
                           
            if (!$user) {

                $have_invite_code = input('have_invite_code/i');
                $parent = NULL;
                if ($have_invite_code == 0) {
                    return error("need_invite");
                } else {
                    $invite_code = input("invite_code/i");
                    if (strlen($invite_code) > 0) {
                        $parent = Db('user')->where('invit_code', $invite_code)->where('disable', 0)->find();
                        if (!$parent) {
                            return error('邀請碼不正确');
                        }
                    }

                }           

繼續閱讀