mirror of
https://github.com/filecoin-project/slate.git
synced 2024-09-11 22:07:08 +03:00
fix(auth): skipping special characters in the email query param
This commit is contained in:
parent
20d17b1881
commit
6590a3a096
@ -103,7 +103,9 @@ export default class CTATransition extends React.Component {
|
||||
const currentURL = Strings.getCurrentURL(this.props.page?.params);
|
||||
this.props.onAction({
|
||||
type: "NAVIGATE",
|
||||
href: `/_/auth?tab=signin&email=${emailOrUsername}&redirect=${encodeURI(currentURL)}`,
|
||||
href: `/_/auth?tab=signin&email=${encodeURIComponent(emailOrUsername)}&redirect=${encodeURI(
|
||||
currentURL
|
||||
)}`,
|
||||
});
|
||||
this._handleClose();
|
||||
};
|
||||
@ -112,7 +114,9 @@ export default class CTATransition extends React.Component {
|
||||
const currentURL = Strings.getCurrentURL(this.props.page?.params);
|
||||
this.props.onAction({
|
||||
type: "NAVIGATE",
|
||||
href: `/_/auth?tab=signup&email=${email}&redirect=${encodeURI(currentURL)}`,
|
||||
href: `/_/auth?tab=signup&email=${encodeURIComponent(email)}&redirect=${encodeURI(
|
||||
currentURL
|
||||
)}`,
|
||||
});
|
||||
this._handleClose();
|
||||
};
|
||||
|
@ -847,7 +847,7 @@ export default function IndexPage() {
|
||||
return errors;
|
||||
},
|
||||
onSubmit: async ({ email }) => {
|
||||
window.open(`/_/auth?tab=signup&email=${email}`, "_self");
|
||||
window.open(`/_/auth?tab=signup&email=${encodeURIComponent(email)}`, "_self");
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -161,10 +161,9 @@ const AuthScene = ({ onAuthenticate, onTwitterAuthenticate, page, onAction, ...p
|
||||
);
|
||||
}
|
||||
// NOTE(amine): if the user goes back, we should prefill the email
|
||||
const emailParam = page?.params?.email ? decodeURIComponent(page?.params?.email) : "";
|
||||
const initialEmail =
|
||||
prevScene === "signin" && context.emailOrUsername
|
||||
? context.emailOrUsername
|
||||
: page?.params?.email || "";
|
||||
prevScene === "signin" && context.emailOrUsername ? context.emailOrUsername : emailParam;
|
||||
|
||||
return (
|
||||
<Initial
|
||||
|
Loading…
Reference in New Issue
Block a user