The token should only be accessible to the user requesting the password reset, meaning that it would be sent via email (this is the standard password reset flow).
The flaw here is that anyone, even if they did not control the email of the user, could reset the password, because the reset token was returned in the browser, where anyone could see it. Essentially, just by knowing someone's email (not having control over it), you could reset their password.