lundi 7 septembre 2020

Which authentication is used for Laravel 5.2?

Hi this is my code which inserts data in sys_entity_auth table.As per my knowledge laravel uses User table for users here there is no user table here we have sys_entity_auth table.this code inserts data in table.the login happens for old data but not with newly inseerted data.the code is hosted on aws.am i doing something wrong? How can i find whic auth library is used for my current project public function signup(Request $request) {

    $user = SYSEntityAuth::where('email', '=', $request->email)->first();
    if ($user === null) {
        $this->_apiData['response'] = "success";
        //$driver = new SYSEntityAuth(); 
       // $password = $driver->password;
        //$driver->email = $request->email;
        //$driver->name = $request->first_name.$request->last_name;
        //$driver->mobile_no = $request->mobile_no;
        //$driver->password = config('panel.SALT') . md5(md5(config('panel.SALT') . sha1(config('panel.SALT') . $password)));
         // create auth data if not available
         if ($request->is_auth_exists == 0) {
            // init data
            $entity = array();
            // set data
            // optional params if available
            if (isset($optionalFields[0])) {
                foreach ($optionalFields as $optionalField) {
                    if ($request->input($optionalField, "") != "") {
                        $entity[$optionalField] = $request->{$optionalField};
                    }
                }
            }

            // set name
            $entity["name"] = $request->input("first_name");

            if(isset($request->last_name) && !empty($request->last_name)){
                $entity["name"] .= ' '.$request->input("last_name");
            }

            $entity['email'] = $request->input("email");
            $entity['password'] = $request->input("password");
            $entity['mobile_no'] = str_replace("+", "", $request->input("mobile_no"));
            $entity['has_temp_password'] = $request->has_temp_password;

            $entity['status'] = $request->input("user_status", 0);
            if(intval($entity['status']) == 1){
                $entity['status'] = 1;
                $entity['is_verified'] = 1;
                $entity['verified_at'] = date('Y-m-d');
                $entity['verification_token'] = NULL;

            }

            

            //$entity['status'] = 1; // temp
            // process signup
            $insert_data = $this->_model->signup($entity,$request->entity_type_id);
            unset($entity);

            $request->merge(array($this->_model->primaryKey => $insert_data->{$this->_model->primaryKey}));
            return $this->__ApiResponse($request, $this->_apiData);
        }
    }else{
        $this->_apiData['message'] = trans('api_errors.entity_already_exists', array("entity" => "Email"));
        return $this->__ApiResponse($request, $this->_apiData);
    }
   // return $this->__ApiResponse($request, $this->_apiData);
}


via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire