Redirect users function of role I need to redirect users function of his role using external authenticate.

In my form_alter() I have:

$form['#validate'] = array(
  'user_login_name_validate',
  'beneficiaire_authenticate',
  'user_login_final_validate'
);
$form['#submit'][] = 'beneficiaire_user_login_dispatch';


My function to authenticate:

function beneficiaire_authenticate($form, &amp;$form_state){
  module_load_include('inc', 'beneficiaire', 'ws');

    if('admin' == $form_state['values']['name']){
        user_login_authenticate_validate($form, $form_state);
    }else{
    $authResponse = beneficiaire_ws_authenticate($form_state['values']['name'], $form_state['values']['pass']);
        if($authResponse)   {
            user_external_login_register($form_state['values']['name'], 'beneficiaire');
            $account = user_external_load($form_state['values']['name']);
            //var_dump($account);exit();
            $form_state['uid'] = $account-&gt;uid;
            $account-&gt;roles[4]= 'beneficiaire';
            user_save($account);
      $_SESSION['account'] = $authResponse;
        }
    }
}


And finally my dispatch function where the aim is to redirect users function of their account status / type:

function beneficiaire_user_login_dispatch($form, &amp;$form_state){
  if($_SESSION['account']-&gt;temporaire){
    drupal_goto('update-password');
  }else{
    drupal_goto('order');
  }
}


My point is, each user is always redirected to /node. How can I redirect them function of account status ?

Thanks
I've found a solution:

function beneficiaire_user_login($form, &amp;$form_state){
  if($_SESSION['account']-&gt;temporaire){
    $_GET['destination'] = 'update-password';
  }else{
    $_GET['destination'] = 'order';
  }
}