Reset password

The email sent through the forgot password process will send the user to an unique link containing the password reset form. To access an example of this page, just click the “Page examples/ Reset password” link in the left sidebar or add /reset-password-example in the URL.

The app/Http/Livewire/ResetPassword.php handles the password reset process and validation.

 

    public function resetPassword() {
        $this->validate();
        $existingUser = User::where('email', $this->email)->first();
        if($existingUser && $existingUser->id == $this->urlId) {
            $existingUser->update([
                'password' => Hash::make($this->password)
            ]);
            $this->isPasswordChanged = true;
            $this->wrongEmail = false;
        }
        else {
            $this->wrongEmail = true;
        }
    }