lundi 26 octobre 2015

Drupal API "user_authenticate()" work but has no effect when called in laravel

I've put this code inside (public/index.php) file in laravel project directory to bootstrap Drupal API :

 $DOCUMENT_ROOT = $_SERVER['DOCUMENT_ROOT'];
 define('DRUPAL_ROOT', $DOCUMENT_ROOT.'drupal738');
 require_once DRUPAL_ROOT . '/includes/bootstrap.inc';
 drupal_bootstrap(DRUPAL_BOOTSTRAP_FULL);

And then inside AuthController , specifically inside postLogin() function i added this code to log in drupal from laravel :

$account = user_authenticate(Input::get('username'), Input::get('password'));

    if ($account) {
        $user = user_load($account, TRUE);
        drupal_session_regenerate();
         return 'Success';
    }
    else {
       return 'Failed';
    }

note that i put return 'Success'; and return 'Failed'; only for debugging purposes to check if it really log me in or not .

When i input correct login credentials it always return Success which means there is no problem in the setup . But when i visit Drupal Site it opens the gust user page instead which means the login from laravel has no effect although it returned success.

is there a way to solve this ?

Note : i suspect that it is something related to cookie path and I've tried to play in drupal settings file and change it but nothing work.



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire