Skip to content

Commit 4ba9e61

Browse files
pcaillaudmory-bot
authored andcommitted
revert: set the new account experience as default for new projects
GitOrigin-RevId: 678a9d7efa5523e7b3e375dcda6acd6179ea7aac
1 parent 35e477b commit 4ba9e61

File tree

9 files changed

+95
-129
lines changed

9 files changed

+95
-129
lines changed

packages/elements-react/.stub-responses/registration/one-step/oidc/missing-fields.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/elements-react/.stub-responses/registration/two-step/oidc/missing-fields.json

Lines changed: 36 additions & 36 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/elements-react/src/theme/default/assets/icons/x.svg

Lines changed: 0 additions & 3 deletions
This file was deleted.

packages/elements-react/src/theme/default/components/card/index.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,7 @@ export function DefaultCard({
2727
return (
2828
<div className={cn("ory-elements", className)} {...rest}>
2929
<div className="flex w-full flex-1 items-start justify-center font-sans-default sm:w-[480px] sm:max-w-[480px] sm:items-center">
30-
<div
31-
className="relative grid w-full grid-cols-1 gap-8 border-b border-form-border-default bg-form-background-default px-8 py-12 sm:rounded-cards sm:border sm:px-12 sm:py-14"
32-
data-testid="ory/card"
33-
>
30+
<div className="relative grid w-full grid-cols-1 gap-8 border-b border-form-border-default bg-form-background-default px-8 py-12 sm:rounded-cards sm:border sm:px-12 sm:py-14">
3431
{children}
3532
<Badge />
3633
</div>

packages/elements-react/src/theme/default/components/form/label.tsx

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,6 @@ function LabelAction({ attributes }: LabelActionProps) {
109109
defaultMessage: "Recover Account",
110110
}),
111111
href: initFlowUrl(config.sdk.url, "recovery", flow),
112-
testId: "recover-account",
113112
}
114113
}
115114
} else if (attributes.type === "password") {
@@ -119,7 +118,6 @@ function LabelAction({ attributes }: LabelActionProps) {
119118
defaultMessage: "Forgot password?",
120119
}),
121120
href: initFlowUrl(config.sdk.url, "recovery", flow),
122-
testId: "forgot-password",
123121
}
124122
}
125123
}
@@ -137,7 +135,6 @@ function LabelAction({ attributes }: LabelActionProps) {
137135
<a
138136
href={action.href}
139137
className="text-button-link-brand-brand underline transition-colors hover:text-button-link-brand-brand-hover"
140-
data-testid={`ory/screen/login/action/${action.testId}`}
141138
>
142139
{action.message}
143140
</a>

packages/elements-react/src/theme/default/components/form/pin-code-input.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ export const DefaultPinCodeInput = ({ attributes }: OryNodeInputProps) => {
2626
onChange={handleInputChange}
2727
name={name}
2828
value={value}
29-
data-testid={`ory/form/node/input/${name}`}
3029
>
3130
<InputOTPGroup
3231
className={cn(

packages/elements-react/src/theme/default/components/generic/toast.tsx

Lines changed: 15 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,13 @@ import {
66
OryToastProps,
77
uiTextToFormattedMessage,
88
} from "@ory/elements-react"
9-
import { toast as sonnerToast } from "sonner"
109
import { cn } from "../../utils/cn"
1110
import { useIntl } from "react-intl"
12-
import IconX from "../../assets/icons/x.svg"
1311

1412
export function DefaultToast({
1513
message,
1614
// Id can be used to close the toast later, but we don't use it here
17-
id,
15+
id: _,
1816
}: OryToastProps) {
1917
const intl = useIntl()
2018

@@ -25,32 +23,22 @@ export function DefaultToast({
2523
const messageText = uiTextToFormattedMessage(message, intl)
2624
return (
2725
<div
28-
className="flex-col rounded-cards border border-interface-border-default-primary bg-interface-background-default-inverted px-4 py-2"
26+
className="flex-col rounded-cards border border-interface-border-default-primary bg-interface-background-default-inverted p-5"
2927
{...messageTestId(message)}
3028
>
31-
<div className="flex items-center justify-between">
32-
<p
33-
className={cn("font-medium", {
34-
"text-interface-foreground-validation-success":
35-
message.type === "success",
36-
"text-interface-foreground-validation-danger":
37-
message.type === "error",
38-
"text-interface-foreground-validation-warning":
39-
// Currently unused from Kratos, but kept for future use
40-
(message.type as "warning") === "warning",
41-
})}
42-
>
43-
{title}
44-
</p>
45-
<button
46-
data-testid={`ory/message/${message.id}.close`}
47-
className="cursor-pointer text-interface-foreground-default-inverted"
48-
onClick={() => sonnerToast.dismiss(id)}
49-
>
50-
<IconX size={16} />
51-
</button>
52-
</div>
53-
29+
<p
30+
className={cn("font-medium", {
31+
"text-interface-foreground-validation-success":
32+
message.type === "success",
33+
"text-interface-foreground-validation-danger":
34+
message.type === "error",
35+
"text-interface-foreground-validation-warning":
36+
// Currently unused from Kratos, but kept for future use
37+
(message.type as "warning") === "warning",
38+
})}
39+
>
40+
{title}
41+
</p>
5442
<p className="text-interface-foreground-default-inverted">
5543
{messageText}
5644
</p>

packages/elements-react/src/theme/default/flows/error.tsx

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -202,10 +202,7 @@ export function Error({
202202
Time: <code>{parsed.timestamp?.toUTCString()}</code>
203203
</p>
204204
<p className="text-sm text-interface-foreground-default-secondary">
205-
Message:{" "}
206-
<code data-testid={"ory/screen/error/message"}>
207-
{parsed.reason}
208-
</code>
205+
Message: <code>{parsed.reason}</code>
209206
</p>
210207

211208
<div>

packages/elements-react/src/util/onSubmitLogin.ts

Lines changed: 6 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33

44
import {
55
FlowType,
6-
handleContinueWith,
76
LoginFlow,
87
loginUrl,
98
UpdateLoginFlowBody,
@@ -44,20 +43,12 @@ export async function onSubmitLogin(
4443
flow: flow.id,
4544
updateLoginFlowBody: body,
4645
})
47-
.then(async (res) => {
48-
const body = await res.value()
49-
50-
const didContinueWith = handleContinueWith(body.continue_with, {
51-
onRedirect,
52-
})
53-
54-
if (!didContinueWith) {
55-
// We did not receive a valid continue_with, but the state flow is still a success. In this case we re-initialize
56-
// the registration flow which will redirect the user to the default url.
57-
onRedirect(loginUrl(config), true)
58-
}
59-
60-
return
46+
.then(() => {
47+
// TODO Remove this workaround. If the return_to value is missing we redirect to the browser endpoint which will redirect us
48+
// TODO to the default_redirect_url. Ideally, this value comes from the project config.
49+
window.location.href =
50+
// eslint-disable-next-line promise/always-return
51+
flow.return_to ?? config.sdk.url + "/self-service/login/browser"
6152
})
6253
.catch(
6354
handleFlowError({

0 commit comments

Comments
 (0)