php - user_login_submit() is not working in Drupal 8 with AngularJS -
i working angularjs, rest api & drupal 8. able pass values between angularjs , php, drupal user authentication working, user_login_submit() not working. in console, shows 500 internal server error
please take of code
if(isset($_post)){ // getting posted data , decodeing json $_post = json_decode(file_get_contents('php://input'), true); $username = $_post['username']; $password = $_post['password']; $form_state['uid'] = \drupal::service('user.auth')->authenticate($username, $password); $uid = $form_state['uid']; if($uid != '' || $uid != null){ $user = user_load($uid); user_login_submit($form, &$form_state); return 'successfully logged in'; } else{ return false; } }
$username = $_post['username']; $password = $_post['password'];
must be
$username = $_post['name']; $password = $_post['pass'];
hope works.
Comments
Post a Comment