# 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\Livewire\Auth\Login` handles the logging in of an existing user.

                    public function login() {
                      $credentials = $this->validate();
                      if(auth()->attempt(['email' => $this->email, 'password' => $this->password], $this->remember_me)) {
                          $user = User::where(["email" => $this->email])->first();
                          auth()->login($user, $this->remember_me);
                          return redirect()->intended('/dashboard');
                      }
                      else{
                          return $this->addError('email', trans('auth.failed'));
                      }
                  }

The user is not able to edit profile or to access other pages because there is a validation of the entered data. If the data does no match with an account from the database the user is instructed to check the credentials.

                  protected $rules = [
                      'email' => 'required|email',
                      'password' => 'required',
                  ];

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