Skip to content

Commit

Permalink
update login-link
Browse files Browse the repository at this point in the history
  • Loading branch information
edwardcho1231 committed Mar 5, 2024
1 parent 75d9f95 commit 6667b8a
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 31 deletions.
4 changes: 4 additions & 0 deletions blocks/identity-block/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,10 @@
.b-login-links {
@include scss.block-components("login-links");
@include scss.block-properties("login-links");
&__inner-link {
@include scss.block-components("login-links-inner-link");
@include scss.block-properties("login-links-inner-link");
}
}

.b-reset-password {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { Paragraph, useIdentity } from "@wpmedia/arc-themes-components";
import useSales from "../../utils/useSales";
import ReCAPTCHA from "react-google-recaptcha";


const BotChallengeProtection = ({ challengeIn, setCaptchaToken, className }) => {
const { Identity, isInitialized } = useIdentity();
const { Sales } = useSales();
Expand Down Expand Up @@ -69,13 +68,4 @@ const BotChallengeProtection = ({ challengeIn, setCaptchaToken, className }) =>
);
};

BotChallengeProtection.propTypes = {
customFields: PropTypes.shape({
challengeIn: PropTypes.oneOf(['signup', 'signin', 'magiclink', 'checkout']).tag({
name: "Challenge In",
defaultValue: "signup",
})
}),
};

export default BotChallengeProtection;
4 changes: 2 additions & 2 deletions blocks/identity-block/features/login-links/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from "react";
import PropTypes from "@arc-fusion/prop-types";
import { useFusionContext } from "fusion:context";
import getTranslatedPhrases from "fusion:intl";
import { Link, Stack } from "@wpmedia/arc-themes-components";
import { Link, Paragraph, Stack } from "@wpmedia/arc-themes-components";

const BLOCK_CLASS_NAME = "b-login-links";
const defaultLoginURL = "/account/login/";
Expand Down Expand Up @@ -35,7 +35,7 @@ const LoginLinks = ({ customFields }) => {
<Link href={forgotURL}>{phrases.t("identity-block.login-links-forgot")}</Link>
) : null}
{showSignUp ? (
<Link href={signUpURL}>{phrases.t("identity-block.login-links-signup")}</Link>
<Paragraph>{phrases.t("identity-block.login-links-signup")}<Link href={signUpURL} className={`${BLOCK_CLASS_NAME}__inner-link`}>{phrases.t("identity-block.sign-up-natural")}</Link></Paragraph>
) : null}
</Stack>
);
Expand Down
17 changes: 1 addition & 16 deletions blocks/identity-block/features/login/default.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import validateURL from "../../utils/validate-redirect-url";
const BLOCK_CLASS_NAME = "b-login-form";

const Login = ({ customFields }) => {
const { redirectURL, redirectToPreviousPage, loggedInPageLocation, OIDC, signUpURL } = customFields;
const { redirectURL, redirectToPreviousPage, loggedInPageLocation, OIDC } = customFields;

const url_string = window.location.href;
const url = new URL(url_string);
Expand All @@ -35,12 +35,6 @@ const Login = ({ customFields }) => {
});
const { loginByOIDC } = useOIDCLogin();

const redirectToSignUp = () => {
if(signUpURL){
window.location = signUpURL;
}
}

if (!isInitialized) {
return null;
}
Expand Down Expand Up @@ -88,9 +82,6 @@ const Login = ({ customFields }) => {
<BotChallengeProtection className={BLOCK_CLASS_NAME} challengeIn={"signin"} setCaptchaToken={setCaptchaToken}/>
<Paragraph className={`${BLOCK_CLASS_NAME}__privacy-statement`}>{phrases.t("identity-block.privacy-statement")}</Paragraph>
</HeadlinedSubmitForm>
<div className={`${BLOCK_CLASS_NAME}__sign-up-div`}>
<Paragraph>Need to create an account? <button onClick={redirectToSignUp} className={`${BLOCK_CLASS_NAME}__sign-up-button`}>{phrases.t("identity-block.sign-up")}</button></Paragraph>
</div>
</>
);
};
Expand All @@ -115,12 +106,6 @@ Login.propTypes = {
description:
"The URL to which a user would be redirected to if visiting a login page when already logged in.",
}),
signUpURL: PropTypes.string.tag({
name: "Sign up URL",
defaultValue: "/signup/",
description:
"The URL to which a user would be redirected to if the user clicks on the sign up button",
}),
OIDC: PropTypes.bool.tag({
name: 'Login with OIDC',
defaultValue: false,
Expand Down
5 changes: 4 additions & 1 deletion blocks/identity-block/intl.json
Original file line number Diff line number Diff line change
Expand Up @@ -643,7 +643,7 @@
"id": "Belum memiliki akun? Daftar",
"fr": "Sign up for an account.",
"es": "Sign up for an account.",
"en": "Don't have an account? Sign up",
"en": "Need to create an account? ",
"de": "Sign up for an account.",
"bo": "ཁྱེད་ལ་དྲ་གྲངས་མེད་དམ། ཐོ་འགོད།",
"bn": "কোনো অ্যাকাউন্ট নেই?\nসাইন আপ করুন",
Expand Down Expand Up @@ -1282,5 +1282,8 @@
},
"identity-block.privacy-statement": {
"en": "By creating an account, you agree to the Terms of Service and acknowledge our Privacy Policy."
},
"identity-block.sign-up-natural": {
"en": "Sign up"
}
}
15 changes: 14 additions & 1 deletion blocks/identity-block/themes/news.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,15 @@
"login-links": {
"styles": {
"default": {
"font-family": "inter",
"components": {
"paragraph": {
"text-align": "center",
"font-family": "inter"
},
"link": {
"text-align": "center"
"text-align": "center",
"font-family": "inter"
},
"link-hover": {
"color": "var(--text-color-subtle)"
Expand All @@ -352,6 +358,13 @@
"desktop": {}
}
},
"login-links-inner-link": {
"styles": {
"default": {
"text-decoration": "underline"
}
}
},
"reset-password": {
"styles": {
"default": {
Expand Down
3 changes: 2 additions & 1 deletion locale/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@
"identity-block.login-form-error": "There's been an error logging you in",
"identity-block.login-links-forgot": "Forgot your password?",
"identity-block.login-links-login": "Already have an account? Log in",
"identity-block.login-links-signup": "Don't have an account? Sign up",
"identity-block.login-links-signup": "Need to create an account? ",
"identity-block.login-options": "Log in options",
"identity-block.manage-account": "Manage Your Account",
"identity-block.new-password": "New Password",
Expand All @@ -154,6 +154,7 @@
"identity-block.reset-password-submit-submitted": "Continue to log in",
"identity-block.save": "Save",
"identity-block.sign-up": "Sign Up",
"identity-block.sign-up-natural": "Sign up",
"identity-block.sign-up-form-error": "There's been an error creating your account",
"identity-block.terms-privacy-text": "By creating an account, you agree to the <a href='%{termsURL}'>Terms of Service<\/a> and acknowledge our <a href='%{privacyURL}'>Privacy Policy<\/a>.",
"identity-block.update-email-error": "There's been an error updating your email address",
Expand Down

0 comments on commit 6667b8a

Please sign in to comment.