Skip to content

Conversation

anusha-c18
Copy link
Contributor

@anusha-c18 anusha-c18 commented Sep 19, 2025

  • Add identifier first login
    • Add enter email page
    • Add server side email validation and handle error messages
    • Add enter password page
  • Reset password overhaul
    • Add debounce for password validation
    • Add show/hide password functionality
    • Only show errors on password input on blur
    • Handle confirmation password errors
    • Show success message when confirmation password matches expected password
  • Update e2e test
    • Update login e2e test with new screenshots
    • Add screenshot options configuration

Identifier first login

Screen.Recording.2025-09-25.at.8.05.16.PM.mov

Email validation

Screenshot 2025-09-25 at 8 07 21 PM Screenshot 2025-09-25 at 8 07 29 PM Screenshot 2025-09-25 at 8 07 43 PM

Reset Password

Screen.Recording.2025-09-25.at.8.09.21.PM.mov

Copy link

codecov bot commented Sep 19, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 44.72%. Comparing base (bc73db5) to head (6204892).
⚠️ Report is 17 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #759   +/-   ##
=======================================
  Coverage   44.72%   44.72%           
=======================================
  Files          39       39           
  Lines        3204     3204           
=======================================
  Hits         1433     1433           
  Misses       1688     1688           
  Partials       83       83           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@anusha-c18 anusha-c18 force-pushed the registration branch 5 times, most recently from 916da45 to 0e898b6 Compare September 24, 2025 17:45
@anusha-c18 anusha-c18 marked this pull request as ready for review September 25, 2025 14:41
@anusha-c18 anusha-c18 requested a review from a team as a code owner September 25, 2025 14:41
Comment on lines +316 to +340
const renderFlow: LoginFlow | undefined = flow
? isIdentifierFirst
? {
...flow,
ui: {
...flow.ui,
nodes: flow.ui.nodes.filter((n: UiNode) => {
if (
n.attributes.node_type === "input" &&
typeof (n.attributes as UiNodeInputAttributes).name === "string"
) {
const name = (n.attributes as UiNodeInputAttributes).name;
return (
name === "identifier" ||
name === "csrf_token" ||
name === "method"
);
}
return false;
}),
},
}
: isAuthCode
? filterFlow(replaceAuthLabel(flow))
: flow
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue: nested ternary operator inside ternary operator == hurts to read
we need to improve readability of the code, can you please break it down?

Comment on lines 289 to 293
const title = isIdentifierFirst
? "Sign in"
: isAuthCode
? "Verify your identity"
: `Sign in${getTitleSuffix()}`;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue(readability): same as below

Comment on lines 82 to 85
onChange={(e) => {
if (!hasTouched) setHasTouched(true);
setPassword(e.target.value);
}}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you please move the inline function to a React.useCallback?

Comment on lines 42 to 53
const validateCheck = (check: PasswordCheckType, value: string): boolean => {
switch (check) {
case "lowercase":
return /[a-z]/.test(password) ? "success" : "error";
return /[a-z]/.test(value);
case "uppercase":
return /[A-Z]/.test(password) ? "success" : "error";
return /[A-Z]/.test(value);
case "number":
return /[0-9]/.test(password) ? "success" : "error";
return /\d/.test(value);
case "length":
return password.length >= 8 ? "success" : "error";
return value.length >= 8;
}
};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue(readability): please move this function out to refactor it to a static function, so the body of the component is not made heavy to read

setPassword(e.target.value);
void setValue(e.target.value);
}}
onKeyDown={(e) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same comment on inline function

Comment on lines 178 to 220
return fetch(
`/api/kratos/self-service/login/id-first?flow=${encodeURIComponent(flowId)}`,
{
method: "POST",
headers: {
"Content-Type": "application/json",
},
body: JSON.stringify({
...values,
method,
flow: String(flow?.id),
}),
},
)
.then(async (res) => {
if (!res.ok) {
throw new Error(await res.text());
}
return (await res.json()) as IdentifierFirstResponse;
})
.then((data) => {
if ("redirect_to" in data) {
window.location.href = data.redirect_to;
return;
}
if (flow?.return_to) {
window.location.href = flow.return_to;
return;
}
setFlow(data);
})
.catch(redirectToErrorPage);
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO this should be in a function, ideally I think it should be part of the kratos object (defined in kratos.ts)

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't it be a method in the kratos sdk object? Also it should re-use the basePath from Kratos sdk, this way we treat it as a single API and if we want to refactor it in the future (e.g. change the basePath) we would just have to change the sdk instantiation instead of having to search the code for hard coded strings.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants