Skip to content

Commit

Permalink
add login without password
Browse files Browse the repository at this point in the history
  • Loading branch information
accbjt committed Mar 18, 2024
1 parent 97c07f8 commit 3a336f7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions blocks/identity-block/_index.scss
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@
.b-login-links {
@include scss.block-components("login-links");
@include scss.block-properties("login-links");
&-ota-link {
@include scss.block-components("login-links-ota-link");
@include scss.block-properties("login-links-ota-link");
}
}

.b-reset-password {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ const HeadlinedSubmitForm = ({
</HeadingSection>
<form aria-label={headline} onSubmit={handleSubmit} ref={formRef}>
{children}
<Button size="medium" variant="primary" fullWidth type="submit">
<Button size="large" variant="primary" fullWidth type="submit">
{buttonLabel}
</Button>
{formErrorText ? (
Expand Down
13 changes: 12 additions & 1 deletion 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, Stack, Button } from "@wpmedia/arc-themes-components";

const BLOCK_CLASS_NAME = "b-login-links";
const defaultLoginURL = "/account/login/";
Expand All @@ -12,6 +12,7 @@ const defaultSignUpURL = "/account/signup/";
const LoginLinks = ({ customFields }) => {
const {
showLogin = false,
showLoginWithoutPassword = false,
loginURL = defaultLoginURL,
showForgot = false,
forgotURL = defaultForgotURL,
Expand All @@ -28,6 +29,11 @@ const LoginLinks = ({ customFields }) => {

return (
<Stack as="div" className={BLOCK_CLASS_NAME}>
{showLoginWithoutPassword && (
<Button className={`${BLOCK_CLASS_NAME}-ota-link`} size="large" fullWidth type="submit">
Log in without password
</Button>
)}
{showLogin ? (
<Link href={loginURL}>{phrases.t("identity-block.login-links-login")}</Link>
) : null}
Expand All @@ -52,6 +58,11 @@ LoginLinks.propTypes = {
defaultValue: false,
group: "Login",
}),
showLoginWithoutPassword: PropTypes.bool.tag({
name: "Show Login without password",
defaultValue: false,
group: "Login",
}),
loginURL: PropTypes.string.tag({
name: "Login URL",
defaultValue: defaultLoginURL,
Expand Down
10 changes: 9 additions & 1 deletion blocks/identity-block/themes/news.json
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,14 @@
"desktop": {}
}
},
"login-links-ota-link": {
"styles": {
"default": {
"border": "1px solid black"
},
"desktop": {}
}
},
"reset-password": {
"styles": {
"default": {
Expand Down Expand Up @@ -426,4 +434,4 @@
"desktop": {}
}
}
}
}

0 comments on commit 3a336f7

Please sign in to comment.