خرید بک لینک

Vote count: 0

I am making api in laravel. I am using the database that is already built and is live. That system uses md5 with salt values. I want to do authentication for that system . how should do i have to do? My source code :

public function authenticate(Request $request)
{
 $email = $request->input('email');
 $password = md5('testpassword' . 'saltvaluehere');
 try {
        //

        // attempt to verify the credentials and create a token for the user
        if (!$token = JWTAuth::attempt([
            'email' => $email,
            'pass' => $password
        ])
        ) {


            retu response()->json(['error' => 'invalid_credentials'], 401);
        }
    } catch (JWTException $e) {
        // something went wrong whilst attempting to encode the token
        retu response()->json(['error' => 'could_not_create_token'], 500);
    }

    // all good so retu the token
    retu response()->json(compact('token'));
}

In core php these authentication is done by:

$getpass        = $mydb->CleanString($_POST['password']); 
$getuseame    = $mydb->CleanString($_POST['useame']);
$dbpass = $mydb->md5_decrypt($mydb->getValue("pass","tbl_admin","useame = '".$getuseame."'"), SECRETPASSWORD);

    if($dbpass == $getpass){
retu 'success full login';
}

above code doesnot give same value of hash, so i am not being able to authenticate in system.

asked 3 mins ago

برچسب: نویسنده: استخدام کار تاريخ: جمعه 17 ارديبهشت 1395 ساعت: 14:28

صفحه بندی