mirror of
https://github.com/storytold/artcraft.git
synced 2026-11-14 22:02:36 +00:00
fixed password reset button
This commit is contained in:
1 parent
81018f6f7f
commit
75e51b3e9c
2 files changed
+30
-26
No files matched your search
@@ -23,12 +23,13 @@ export default function Button({
|
||||
disabled,
|
||||
isLoading = false,
|
||||
isActive,
|
||||
type = "button",
|
||||
...rest
|
||||
}: ButtonProps) {
|
||||
let variant = variantProps;
|
||||
if(isActive !== undefined){
|
||||
if(isActive) variant = "primary"
|
||||
else variant = "secondary"
|
||||
if (isActive !== undefined) {
|
||||
if (isActive) variant = "primary";
|
||||
else variant = "secondary";
|
||||
}
|
||||
let iconMarginClass = !square && label ? (iconFlip ? "ms-2" : "me-2") : "";
|
||||
let IconComponent = icon ? (
|
||||
@@ -90,7 +91,7 @@ export default function Button({
|
||||
{ButtonContent}
|
||||
</a>
|
||||
) : (
|
||||
<button {...{ ...commonProps, ...rest, type: "button", ref: buttonRef }}>
|
||||
<button {...{ ...commonProps, ...rest, type: type, ref: buttonRef }}>
|
||||
{ButtonContent}
|
||||
</button>
|
||||
);
|
||||
|
||||
@@ -9,7 +9,8 @@ import { Button } from "components/common";
|
||||
import Panel from "components/common/Panel";
|
||||
import { faEnvelope } from "@fortawesome/pro-solid-svg-icons";
|
||||
import {
|
||||
RequestResetPassword, RequestResetPasswordIsSuccess,
|
||||
RequestResetPassword,
|
||||
RequestResetPasswordIsSuccess,
|
||||
} from "@storyteller/components/src/api/user/RequestResetPassword";
|
||||
import { useSession } from "hooks";
|
||||
|
||||
@@ -26,16 +27,18 @@ function PasswordResetEmailPage(props: Props) {
|
||||
const [emailOrUsername, setEmailOrUsername] = useState("");
|
||||
const [isSent, setIsSent] = useState(false);
|
||||
|
||||
if (user) { history.push("/"); }
|
||||
|
||||
const handleChange = (
|
||||
ev: React.FormEvent<HTMLInputElement>
|
||||
) => {
|
||||
const value = (ev.target as HTMLInputElement).value;
|
||||
setEmailOrUsername(value);
|
||||
if (user) {
|
||||
history.push("/");
|
||||
}
|
||||
|
||||
const onSubmit = async ( ev: any ) : Promise<boolean> => {
|
||||
const handleChange = (ev: React.FormEvent<HTMLInputElement>) => {
|
||||
const value = (ev.target as HTMLInputElement).value;
|
||||
setEmailOrUsername(value);
|
||||
};
|
||||
|
||||
const onSubmit = async (
|
||||
ev: React.FormEvent<HTMLFormElement>
|
||||
): Promise<boolean> => {
|
||||
ev.preventDefault();
|
||||
|
||||
const value = emailOrUsername.trim();
|
||||
@@ -45,7 +48,7 @@ function PasswordResetEmailPage(props: Props) {
|
||||
}
|
||||
|
||||
const request = {
|
||||
username_or_email: value
|
||||
username_or_email: value,
|
||||
};
|
||||
|
||||
RequestResetPassword(request).then((res: any) => {
|
||||
@@ -55,21 +58,21 @@ function PasswordResetEmailPage(props: Props) {
|
||||
});
|
||||
|
||||
return false;
|
||||
}
|
||||
};
|
||||
|
||||
if (isSent) {
|
||||
return (
|
||||
<Container type="panel" className="login-panel">
|
||||
<PageHeader
|
||||
title="Password Reset Sent"
|
||||
subText="If you entered a valid email or username, an email with instructions to reset your password has been sent your way. "
|
||||
panel={false}
|
||||
showBackButton={true}
|
||||
/>
|
||||
<Link to={"/password-reset/verify"}>
|
||||
Click here once you have the code.
|
||||
</Link>
|
||||
</Container>
|
||||
<Container type="panel" className="login-panel">
|
||||
<PageHeader
|
||||
title="Password Reset Sent"
|
||||
subText="If you entered a valid email or username, an email with instructions to reset your password has been sent your way. "
|
||||
panel={false}
|
||||
showBackButton={true}
|
||||
/>
|
||||
<Link to={"/password-reset/verify"}>
|
||||
Click here once you have the code.
|
||||
</Link>
|
||||
</Container>
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user