1

I'm testing out the new Laravel and when creating a basic application

composer create-project laravel/laravel composer install composer update php artisan make:auth 

I'm presented with the basic authentication scaffold, after doing a little playing around, the links on the menu for logging in and registers stop working. I coudn't find the problem to fix it so I just created a new project.

And the same has happened again.

All i've done is

  1. Created a new view members.dashboard
  2. Set the login redirect to go to the dash board after logging in

Has anyone seen this problem before and can point me to the error?

UPDATE

/auth/login = no route /auth/register = no route /login = redirect to home page /register = redirect to home page 
8
  • is /auth/login OR /auth/register accessible? Commented Jan 12, 2016 at 17:18
  • have you tried deleting the cookies? what happens when you access login URL after deleting the cookies? Commented Jan 12, 2016 at 17:22
  • @eMAD i've updated the question Commented Jan 12, 2016 at 17:24
  • are all your routes that are using that layout in the 'web' middleware group ? Commented Jan 12, 2016 at 17:25
  • /login = redirect to home page /register = redirect to home page means you are logged in Commented Jan 12, 2016 at 17:25

2 Answers 2

1

You were logged in & cookies were keeping track of your authentication status. Thus you are redirected to home page when you visit

/login /register 

In Laravel Auth, Logged-In users can't view login page or register page. You have to either logout OR delete the cookies (not a recommended way) to view these pages again.

Sign up to request clarification or add additional context in comments.

4 Comments

but what if I would like to create new user with my admin account (=register new one) and don't want public to register .. how can I do that?
Make that Create new User page's URL accessible only to user who is logged-in as well as his role is admin.
I did it but when I try to access /register route, it doesn't work ... nothing happen
You do not need the default functionality of Auth routes (Especially that of /register). You should create a Custom Create new User page and create a new private route (say /add-user) for this page.
0

If you are making mention to the 'Login' and 'Register' links the layout supplies, they work fine.

By default the '/' route doesn't have the 'web' middleware group applied, so no sessions/auth. Auth will think you are not logged in if you don't have that middleware group applied to any routes where you need to use Auth.

Comments