# Forgot Password

If an existing user forgot his password he has the possibility of resetting his password.

To reset the password the user should click on the `here` button under the login form or add `/reset-password` in the url.

The `App\Http\Controllers\Auth\ResetPAsswordController.php` takes care of sending an email to the user where he can reset the password afterwards.

    public function send(Request $request)
    {
        $email = $request->validate([
            'email' => ['required']
        ]);
        $user = User::where('email', $email)->first();

        if (config('app.is_demo')){
            return back()->with('error', 'You cannot change your password in the demo version');
        } else {
            if ($user) {
                $this->notify(new ForgotPassword($user->id));
                return back()->with('succes', 'An email was send to your email address');
            }
        }
    }