diff --git a/config/routes.rb b/config/routes.rb index f6f5786ca..5a5eccaed 100755 --- a/config/routes.rb +++ b/config/routes.rb @@ -63,7 +63,7 @@ FarmBot::Application.routes.draw do get "/tos_update" => "dashboard#tos_update", as: :tos_update post "/csp_reports" => "dashboard#csp_reports", as: :csp_report - get "/password_reset/:token" => "dashboard#password_reset", as: :password_reset + get "/password_reset/*token" => "dashboard#password_reset", as: :password_reset get "/verify/:token" => "dashboard#verify", as: :verify_user match "/app/*path", to: "dashboard#main_app", via: :all, constraints: { format: "html" } diff --git a/webpack/account/components/change_password.tsx b/webpack/account/components/change_password.tsx index 85fbaaa42..639141ec8 100644 --- a/webpack/account/components/change_password.tsx +++ b/webpack/account/components/change_password.tsx @@ -10,7 +10,7 @@ import { import { SpecialStatus } from "../../resources/tagged_resources"; import Axios from "axios"; import { API } from "../../api/index"; -import { prettyPrintApiErrors } from "../../util"; +import { prettyPrintApiErrors, equals } from "../../util"; import { success, error } from "farmbot-toastr/dist"; interface PasswordForm { @@ -37,8 +37,8 @@ export class ChangePassword extends React.Component<{}, ChangePWState> { /** Set the `status` flag to `undefined`, but only if the form is empty. * Useful when the user manually clears the form. */ - maybeClearForm = () => wowFixMe(EMPTY_FORM, this.state.form) ? - this.clearForm() : false; + maybeClearForm = + () => equals(EMPTY_FORM, this.state.form) ? this.clearForm() : false; clearForm = () => this.setState({ status: SpecialStatus.SAVED, form: EMPTY_FORM }); @@ -103,9 +103,3 @@ export class ChangePassword extends React.Component<{}, ChangePWState> { ; } } - -// TODO: Why does Object.is() not work when comparing EMPTY_FORM to -// this.state.form? Using this in the meantime. PRs and feedback welcome. -function wowFixMe(l: T, r: T): boolean { - return (JSON.stringify(l) === JSON.stringify(r)); -}