Skip to content

Commit

Permalink
chore: synchronize workspaces
Browse files Browse the repository at this point in the history
  • Loading branch information
aeneasr committed Jun 10, 2024
1 parent 09c5e43 commit 330df0a
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 18 deletions.
5 changes: 2 additions & 3 deletions src/react-components/ory/helpers/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,11 @@ export const hasGroup = (group: string) => (nodes: UiNode[]) =>

export const hasOidc = hasGroup("oidc")
export const hasPassword = hasGroup("password")
export const hasIdentityDiscovery = hasGroup("identity_discovery")
export const hasDefault = hasGroup("default")
export const hasDefault = hasGroup("default")
export const hasProfile = hasGroup("profile")
export const hasWebauthn = hasGroup("webauthn")
export const hasPasskey = hasGroup("passkey")
export const hasTwoStep = hasGroup("two_step")
export const hasIdentifierFirst = hasGroup("identifier_first")
export const hasLookupSecret = hasGroup("lookup_secret")
export const hasTotp = hasGroup("totp")
export const hasCode = hasGroup("code")
Expand Down
2 changes: 1 addition & 1 deletion src/react-components/ory/sections/auth-code-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export const AuthCodeSection = ({
<FilterFlowNodes
filter={{
nodes: nodes,
groups: ["code", "two_step"],
groups: ["code", "identifier_first"],
// we don't want to map the default group twice
// the form already maps hidden fields under the default group
// we are only interested in hidden fields that are under the code group
Expand Down
2 changes: 1 addition & 1 deletion src/react-components/ory/sections/link-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export const LinkSection = ({ nodes }: LinkSectionProps): JSX.Element => (
<FilterFlowNodes
filter={{
nodes: nodes,
groups: ["link", "code", "two_step"],
groups: ["link", "code", "identifier_first"],
attributes: ["hidden"],
}}
/>
Expand Down
12 changes: 6 additions & 6 deletions src/react-components/ory/sections/login-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ import { FormattedMessage } from "react-intl"
import { gridStyle } from "../../../theme"
import { ButtonLink, CustomHref } from "../../button-link"
import { FilterFlowNodes } from "../helpers/filter-flow-nodes"
import { hasPassword, hasTwoStep } from "../helpers/utils"
import { hasPassword, hasIdentifierFirst } from "../helpers/utils"
import { SelfServiceFlow } from "../helpers/types"

export interface LoginSectionProps {
nodes: UiNode[]
forgotPasswordURL?: CustomHref | string
}

export const TwoStepLoginSection = (
export const IdentifierFirstLoginSection = (
flow: SelfServiceFlow,
): JSX.Element | null => {
const nodes = flow.ui.nodes
return hasTwoStep(nodes) ? (
return hasIdentifierFirst(nodes) ? (
<div className={gridStyle({ gap: 32 })}>
<FilterFlowNodes
filter={{
nodes: nodes,
groups: ["default", "two_step"],
groups: ["default", "identifier_first"],
excludeAttributeTypes: ["submit", "hidden"],
}}
/>
<FilterFlowNodes
filter={{
nodes: nodes,
groups: ["two_step"],
groups: ["identifier_first"],
attributes: "submit",
}}
/>
Expand All @@ -46,7 +46,7 @@ export const LoginSection = ({
<FilterFlowNodes
filter={{
nodes: nodes,
groups: ["link", "code", "two_step"],
groups: ["link", "code", "identifier_first"],
attributes: ["hidden"],
}}
/>
Expand Down
10 changes: 5 additions & 5 deletions src/react-components/ory/sections/passwordless-section.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { SelfServiceFlow } from "../helpers/types"
import {
hasDefault,
hasPasskey,
hasTwoStep,
hasIdentifierFirst,
hasWebauthn,
} from "../helpers/utils"

Expand All @@ -18,7 +18,7 @@ export const PasswordlessSection = (
<FilterFlowNodes
filter={{
nodes: flow.ui.nodes,
groups: ["webauthn", "two_step"],
groups: ["webauthn", "identifier_first"],
withoutDefaultAttributes: true,
attributes: ["hidden"], // the form will take care of hidden fields
}}
Expand Down Expand Up @@ -55,7 +55,7 @@ export const PasskeySection = (flow: SelfServiceFlow): JSX.Element | null => {
<FilterFlowNodes
filter={{
nodes: flow.ui.nodes,
groups: ["webauthn", "two_step"],
groups: ["webauthn", "identifier_first"],
withoutDefaultAttributes: true,
attributes: ["hidden"], // the form will take care of hidden fields
}}
Expand Down Expand Up @@ -94,7 +94,7 @@ export const PasskeyLoginSection = (
<FilterFlowNodes
filter={{
nodes: flow.ui.nodes,
groups: ["passkey", "two_step"],
groups: ["passkey", "identifier_first"],
withoutDefaultAttributes: true,
attributes: ["hidden"], // the form will take care of hidden fields
}}
Expand Down Expand Up @@ -122,7 +122,7 @@ export const PasswordlessLoginSection = (
<FilterFlowNodes
filter={{
nodes: flow.ui.nodes,
groups: ["webauthn", "two_step"],
groups: ["webauthn", "identifier_first"],
withoutDefaultAttributes: true,
attributes: ["hidden"], // the form will take care of hidden fields
}}
Expand Down
7 changes: 5 additions & 2 deletions src/react-components/ory/user-auth-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,10 @@ import {
import { AuthCodeSection } from "./sections/auth-code-section"
import { LinkSection } from "./sections/link-section"
import { LoggedInInfo } from "./sections/logged-info"
import { LoginSection, TwoStepLoginSection } from "./sections/login-section"
import {
LoginSection,
IdentifierFirstLoginSection,
} from "./sections/login-section"
import { OIDCSection } from "./sections/oidc-section"
import {
PasskeyLoginSection,
Expand Down Expand Up @@ -359,7 +362,7 @@ export const UserAuthCard = ({
case "login":
$passwordlessWebauthn = PasswordlessLoginSection(flow)
$passkey = PasskeyLoginSection(flow)
$twoStep = TwoStepLoginSection(flow)
$twoStep = IdentifierFirstLoginSection(flow)
$oidc = OIDCSection(flow)
$profile = ProfileLoginSection(flow)
$code = AuthCodeSection({ nodes: flow.ui.nodes })
Expand Down

0 comments on commit 330df0a

Please sign in to comment.