Fix password reset regression
parent
6e2b64b39c
commit
393337e1c9
|
@ -63,7 +63,7 @@ FarmBot::Application.routes.draw do
|
||||||
get "/tos_update" => "dashboard#tos_update", as: :tos_update
|
get "/tos_update" => "dashboard#tos_update", as: :tos_update
|
||||||
post "/csp_reports" => "dashboard#csp_reports", as: :csp_report
|
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
|
get "/verify/:token" => "dashboard#verify", as: :verify_user
|
||||||
|
|
||||||
match "/app/*path", to: "dashboard#main_app", via: :all, constraints: { format: "html" }
|
match "/app/*path", to: "dashboard#main_app", via: :all, constraints: { format: "html" }
|
||||||
|
|
|
@ -10,7 +10,7 @@ import {
|
||||||
import { SpecialStatus } from "../../resources/tagged_resources";
|
import { SpecialStatus } from "../../resources/tagged_resources";
|
||||||
import Axios from "axios";
|
import Axios from "axios";
|
||||||
import { API } from "../../api/index";
|
import { API } from "../../api/index";
|
||||||
import { prettyPrintApiErrors } from "../../util";
|
import { prettyPrintApiErrors, equals } from "../../util";
|
||||||
import { success, error } from "farmbot-toastr/dist";
|
import { success, error } from "farmbot-toastr/dist";
|
||||||
|
|
||||||
interface PasswordForm {
|
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.
|
/** Set the `status` flag to `undefined`, but only if the form is empty.
|
||||||
* Useful when the user manually clears the form. */
|
* Useful when the user manually clears the form. */
|
||||||
maybeClearForm = () => wowFixMe(EMPTY_FORM, this.state.form) ?
|
maybeClearForm =
|
||||||
this.clearForm() : false;
|
() => equals(EMPTY_FORM, this.state.form) ? this.clearForm() : false;
|
||||||
|
|
||||||
clearForm = () => this.setState({ status: SpecialStatus.SAVED, form: EMPTY_FORM });
|
clearForm = () => this.setState({ status: SpecialStatus.SAVED, form: EMPTY_FORM });
|
||||||
|
|
||||||
|
@ -103,9 +103,3 @@ export class ChangePassword extends React.Component<{}, ChangePWState> {
|
||||||
</Widget>;
|
</Widget>;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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<T>(l: T, r: T): boolean {
|
|
||||||
return (JSON.stringify(l) === JSON.stringify(r));
|
|
||||||
}
|
|
||||||
|
|
Loading…
Reference in New Issue