laravelista / comments

Native comments for your Laravel application.
MIT License
744 stars 142 forks source link

Authentication with Sentinel #146

Closed Odenda1 closed 3 years ago

Odenda1 commented 3 years ago

Thank you for an excellent piece of work.

I was able to implement the comments easily into my application, the only issue being that it does not register the authentication. I have logged in and tested the status of authentication but still the comments says "Authentication Required".

The system used Sentinel for authentication. Is there somewhere I need to make a change for this to register the user?

I am very new to Laravel and any assistance would be greatly appreciated.

mabasic commented 3 years ago

I am not familiar with Sentinel. Can you send me a link?

Odenda1 commented 3 years ago

Here is a link to the documentation for Sentinel.

https://cartalyst.com/manual/sentinel/5.x

It uses Sentinel::check() to check if a user is logged in.

Odenda1 commented 3 years ago

If I change the check in the blade file from

@auth

To

@if(Sentinel::check())

I get the form as I should. The form does not however post correctly and no database entry is made. I am also redirected to the home page when I submit the form.

I do not see any errors in the console.

mabasic commented 3 years ago

That is the problem. This package assumes that you use the default Auth::check etc..

You could extend this package to replace Auth:: check with Sentinel::check.

You will need to publish the views and make changes there. Also you will have to extend the controller, make changes there and reference your controller in the config.

The middleware "auth" could be an issue too. Same as policy...

Another option would be to somehow make Auth work with Sentinel if possible.

I hope that you find a solution. If you do please post a comment here for future reference. I'll close this issue now since it is not directly related to the package functionality.

mabasic commented 3 years ago

If I change the check in the blade file from

@auth

To

@if(Sentinel::check())

I get the form as I should. The form does not however post correctly and no database entry is made. I am also redirected to the home page when I submit the form.

I do not see any errors in the console.

See the controller. You will need to make changes there also.