Why I always getting logs Auth::user() on null in my blade template? - laravel-5.5

I use {{ Auth::user()->name }} on all of my blade templates. It successfully shown the user's name though, but why in my logs it written Auth::user()->name is Trying to get property 'name' of non-object. These logs just make things go crazy.
What am I doing wrong? Thanks for your help!

Your code might fail on below code since you don't have a check here if you are logged in or not!
{{ auth()->user()->name }}

First clear out the log file empty it. Assuming its storage/logs/laravel.log
In terminal use following command to look for the live changes in your log file.
{project_root} > tail -f storage/logs/laravel.log
if above doesn't work use following:
{project_root} > sudo tail -f storage/logs/laravel.log
Now, you can keep taps on the log file if anything is logged in it.
Open your browser and terminal/console side by side and go through your App and look for the trigger point when the Exception is logged and shown on the terminal and start debugging from there.

Did you login your application. when you login then only you can get info from auth.
you don't worry about login sign up process in laravel.
just run php artisan make:auth. laravel scaffolding working for you.
this is simple template. you can customize what ever you want.

Related

How to add logs in django

I am new to django I want to print log information in my console how to do that. and also what is the use of that things in django, why we need that one.
If you want to log stuff to your console, javascript's console.log() would be the way to do that. With Django, print statements will show up in your terminal window where the server is running.

Unable to preview in content editor - Sitecore

I have added 2 pages in the content tree - index & Home Page. It was working fine until yesterday. Unable to preview 'index' in the Content editor (CE) now.
The error message is -
The requested document was not found
However, when I do Tools > Browse > Preview, from Sitecore Rocks, it opens fine. Also, I am able to preview 'Home Page' in CE without issue.
Following Mike's Solution Here, I tried to add the user 'Everyone' and removing 'extranet/Anonymous'. But the changes never Save.
Why does it happen to this page alone. No changes made to web.config and I am using only master DB.
UPDATE:
Here is what I have observed.
When 'index' is placed outside the 'en' folder, it can be previewed. Someone suggested that Sitecore is confused by the folder name with its languages. But renaming it to Test-en, also did not work.
I also tried this. Created 'index' outside 'en' folder. Then created a copy of the same inside the 'en' with the name 'index1'. I can preview index1 now, but if 'index' is deleted, it's the same issue again.
I have seen this happen a few times. On a new instance, I don't believe it is permissions, especially if you are using SIM to install (if you aren't - try it!)
Follow these steps and it should fix your issue. Make sure all instances of your browser are closed. They are known to keep hidden instances running. Stop all those tasks. Restart your IIS instance. Log Into your sitecore site with the magical password. Preview the page. You should be able to preview and in fact get the Experience Editor.
I do agree that Sitecore is confused as to the state of that it is logged in as, that is why it is important to close all browser instances.
If you still get this error, clear your logs. Do the above steps and send me your logs. I will look at them for any oddities.
Happy Sitecoring!

Run fuel php app in AWS EC2 instance

I have a fuel php application created by one of my friend.Now I want to run it on aws EC2 instance(ubuntu).I can run the application using apache2 and its index page is loading.After facebook connect from index page it is supposed to show my fb friends list. But it is showing a 404 error POST http://ec2xxxxcompute.amazonaws.com/ajax/auth/facebook not found
I can see a get_facebook() method inside controller(/ajax/auth.php).But it is not catching the method.My top level understanding is i need some url mapping in server level.
Can anyone help me to run the app.Any suggestion will be highly appreciated as a biginner
Are any other URL's loading, or only the index page? If that is the case, it might be a rewriting issue.
Is the default .htaccess file still included in the /public folder? Or did your friend change it?
You may not actually be calling your php code at all. Don't you need something like :
http://ec2xxxxcompute.amazonaws.com/ajax/auth.php/facebook

django social auth error after completing pipeline

I am using django social auth to power facebook connect in my app (admittedly with a little complicated user model and legacy database).
I was redirected to error page and seem to be running into an error AFTER completion of pipeline( redirect as last step of pipeline still redirects me).
Can someone tell me where to look to debug this?
Thanks,
A good place to start would be to look in social-auth's views.py, at the few places where the redirect to LOGIN_ERROR_URL happens (the variable url is set to LOGIN_ERROR_URL and then HttpResponseRedirect(url) is called). Add some print statements, or better, set breakpoints using the python debugger. If you run your app in the Django development server, the print statements will show up in the terminal in which you ran the server. Otherwise, they may show up in your server logs, depending on your configuration. You may also find django-debug-toolbar helpful.
Using print statements or the debugger, my workflow would be:
Figure out what line in views.py the redirect is triggered from
Figure out what condition causes that line to be reached
Inspect the variables leading to that condition
Sorry this is so general. Happy to help more if you can provide some more specific information.
Aaron

Can't Open Web forms for marketers Form Designer or Security Manager

I have had WFFM running on a Sitecore instance for a while, but it has recently stopped working. When I go to "Form Designer" on an existing form, I get the standard Sitecore "The requested document was not found" page.
Requested URL: /applications/modules/web
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
Note that the requested URL is stated as /applications/modules/web instead of /applications/modules/web forms for marketers.
A lot of development has occurred on this site recently, so I'm not sure when exactly this started happening.
Additional: info:
Folder and file permissions are correct.
I've tried reinstalling the WFFM package, and made sure that all the files are in place.
Several processors have been added to the HttpBeginRequest pipeline, but I removed them all to test if they were the cause - they weren't.
I haven't upgraded Sitecore since WFFM was working and the version is correct.
No errors are logged
EDIT
This also seems to be affecting the Sitecore Security Editor:
Requested URL: /appl
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
EDIT 2
Further investigation with this is making me think it is related to the Requested URL. I originally thought the the "Not found" page was displaying the requested url incorrectly. However, if I attempt to goto mysite.com/sitecore/shell/applications/fake folder with spaces/fake page with spaces I get this error message:
Requested URL: /applications/fake folder with spaces/fake page with
spaces
User Name: sitecore\admin
Site Name: shell
If the page you are trying to display exists, please check that an
appropriate prefix has been added to the IgnoreUrlPrefixes setting in
the web.config.
As you can see the Requested Url is correct in the error message. So in relation to my problem, I think maybe Sitecore is requesting the wrong URL in the first place.
Additionally if I go to the go the following url by typing directly into the browser, then the Security Editor opens as expected:
mysite.com/sitecore/shell/Applications/Security/User-Editor
This is quite old now but I thought I'd provide an update for anyone else who encounters the problem.
Unfortunately, Sitecore support weren't able to help beyond pointing out that setting the addAspxExtension attribute to 'true' in the link provider seemed to solve the problem. This may have been acceptable except that extensionless URLs were important to the customer.
In the end I had to amend my link provider so that addAspxExtension is set to 'true' in the web config, and then I set it to false inside the GetItemUrl method for specified sites only.
So now whenever the context site is 'Shell' or 'Admin' etc, the extensions are added by default, but switched off in my main website.
Of course, this is a work around. I still don't know how to actually fix the problem
So the first thing that I am going to tell you is that I suspect that there is something wrong with your site declaration for Sitecore Modules. In your web.config, there's a site declaration for "modules_shell" and "modules_website". Those are where the code files that run the modules are usually located... a shell folder to run the parts that run in the Sitecore shell and a web folder to run the part that is accessed by the externally facing site. Please check your site declarations (and the form.config file) to make sure that you're not in live mode or something like that. I would definitely say that this is where you should start looking.
The next thing is to say that your comments about Sitecore not serving a url in the /sitecore/shell directory is really not surprising. Sitecore processes all requests unless you specifically tell it to ignore requests (like setting it in the IgnoreUrlPrefixes in web.config), it's going to try processing it. Like going to /sitecore/shell/applications gives me a layout error because it doesn't have anything set to handle that request. Now your error suggests that there is something wrong with Site declarations.. however, even if they were all right, it still wouldn't work.