Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/ninety-words-grow.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@asgardeo/react': patch
---

Fix password field type
14 changes: 10 additions & 4 deletions packages/react/src/components/presentation/SignUp/transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,13 @@ const getInputLabel = (name: string, type: string, t: UseTranslation['t']): stri
const label: string = t(i18nKey);

if (label === i18nKey || !label) {
return name.charAt(0).toUpperCase() + name.slice(1);
// Convert camelCase to sentence case (e.g., "firstName" -> "First name")
// TODO: Need to remove this one the following improvement is done.
// Tracker: https://github.com/asgardeo/thunder/issues/725
return name
.replace(/([A-Z])/g, ' $1')
.replace(/^./, str => str.toUpperCase())
.trim();
}

return label;
Expand Down Expand Up @@ -102,9 +108,9 @@ const convertSimpleInputToComponent = (
fieldType = 'password';
}

const variant: 'TEXT' | 'EMAIL' | 'PASSWORD' = getInputVariant(input.type, input.name);
const label: string = getInputLabel(input.name, input.type, t);
const placeholder: string = getInputPlaceholder(input.name, input.type, t);
const variant: 'TEXT' | 'EMAIL' | 'PASSWORD' = getInputVariant(fieldType, input.name);
const label: string = getInputLabel(input.name, fieldType, t);
const placeholder: string = getInputPlaceholder(input.name, fieldType, t);

return {
id: generateId('input'),
Expand Down
Loading