# Login

To access the other pages the user needs to be logged into his account.

If you are not logged in you can only access the Login page or the Sign Up page. The default url takes you to the Login page. Logging in is possible with already existing credentials. An email and a password must pe provided to log into your account.

The `App/Http/Controllers/SessionsController.php` handles the logging in of an existing user.

Copy

                    public function store()
                    {
                        $attributes = request()->validate([
                            'email'=>'required|email',
                            'password'=>'required'
                        ]);

                        if(Auth::attempt($attributes))
                        {
                            session()->regenerate();
                            return redirect('dashboard')->with(['success'=>'You are logged in.']);
                        }
                        else{

                            return back()->withErrors(['email'=>'Email or password invalid.']);
                        }
                    }

If the user forgot his password he can reset the password or if he doesn't have an account he can sign up.