silverbux / laravel-angular-admin

Laravel + Angularjs + Bootstrap + AdminLTE binded by Gulp workflow Admin Dashboard Boilerplate / Starter.
http://silverbux.github.io/laravel-angular-admin/
MIT License
925 stars 414 forks source link

TypeError on login #82

Open neshikj opened 7 years ago

neshikj commented 7 years ago

Hi there I got this errors after setting up environment on first login.

final-e00cef7b48.js:23736 TypeError: Cannot read property 'userRole' of undefined final-e00cef7b48.js:23736 TypeError: Cannot read property 'errors' of undefined

Also I'm getting this as a response from /api/auth/login:
Deprecated: Automatically populating $HTTP_RAW_POST_DATA is deprecated and will be removed in a future version. To avoid this warning set 'always_populate_raw_post_data' to '-1' in php.ini and use the php://input stream instead. in Unknown on line 0

Warning: Cannot modify header information - headers already sent in Unknown on line 0
{"errors":false,"data":{"user":{"id":1,"name":"admin","email":"admin@example.com","avatar":null,"email_verified":"1","email_verification_code":null,"created_at":"2016-10-20 21:57:28","updated_at":null,"roles":[{"id":1,"name":"Super Admin","slug":"admin.super","description":"Super Admin","level":1,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28","pivot":{"user_id":1,"role_id":1,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28"}},{"id":2,"name":"User Admin","slug":"admin.user","description":"Can manage users","level":1,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28","pivot":{"user_id":1,"role_id":2,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28"}},{"id":3,"name":"Role Admin","slug":"admin.role","description":"Can manage user roles","level":1,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28","pivot":{"user_id":1,"role_id":3,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28"}},{"id":4,"name":"Permission Admin","slug":"admin.permission","description":"Can manage permissions","level":1,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28","pivot":{"user_id":1,"role_id":4,"created_at":"2016-10-20 21:57:28","updated_at":"2016-10-20 21:57:28"}}]},"token":"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJzdWIiOjEsImlzcyI6Imh0dHA6XC9cL2xvY2FsaG9zdDo4MDAwXC9hcGlcL2F1dGhcL2xvZ2luIiwiaWF0IjoxNDc3MDAzMzEzLCJleHAiOjE0NzcwMjEzMTMsIm5iZiI6MTQ3NzAwMzMxMywianRpIjoiMzk0NzE5ZDI3ZWVmZGZjYWE2MmY3NTZiZGNiMWFmYmQifQ.3KJGBeVMXYrrfE1ixqjPMSOmuyG8Fllcs0bObjv8Nnk","abilities":{"admin.super":["manage.users","manage.roles","manage.permissions"],"admin.user":["manage.users"],"admin.role":["manage.roles"],"admin.permission":["manage.permissions"]},"userRole":["admin.super","admin.user","admin.role","admin.permission"]}}

silverbux commented 7 years ago

Turn off your php error messages are you on production? the script is working since it's returning json data, it's just that because of the deprecation message you are getting header already sent error

neshikj commented 7 years ago

At first sight I thought that it could be a bug in PHP 5.6 that was overlooked or maybe it's triggered when something else than this variable is used.

This is the feedback maybe from the guy that added this to PHP (http://fr.reddit.com/r/PHP/comments/2jpzzj/php_56_throws_e_deprecated_by_default_for_no/).

It feels stupid but yes, by default PHP 5.6 ships with a configuration that throws deprecated notices and the only fix is for users to add this to their php.ini: always_populate_raw_post_data=-1