Skip to content

Commit

Permalink
OTP & Localities localisation fix (#1391)
Browse files Browse the repository at this point in the history
* fix

* fix

* Update micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js

* Update micro-ui/web/micro-ui-internals/packages/modules/core/src/pages/citizen/Home/UserProfile.js

* Update UserProfile.js

---------

Co-authored-by: nabeelmd-eGov <nabeel.md@egovernments.org>
  • Loading branch information
aaradhya-egov and nabeelmd-eGov authored Sep 17, 2024
1 parent d1fab1f commit 49481a4
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 6 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import { LocalizationService } from "./Localization/service";

const ADMIN_CODE = ({ tenantId, hierarchyType }) => {
if(Digit.Utils.getMultiRootTenant()){
return hierarchyType.code;
}else{
return tenantId.replace(".", "_").toUpperCase() + "_" + hierarchyType.code;
}
};

const getI18nKeys = (localitiesWithLocalizationKeys) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -724,7 +724,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
name="mobileNumber"
placeholder="Enter a valid Mobile No."
onChange={(value) => setUserMobileNumber(value)}
disable={true}
disable={Digit.Utils.getMultiRootTenant()? false : true}
{...{
required: true,
pattern: "[6-9]{1}[0-9]{9}",
Expand Down Expand Up @@ -759,7 +759,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {
name="email"
value={email}
onChange={(e) => setUserEmailAddress(e.target.value)}
disabled={editScreen}
disabled={Digit.Utils.getMultiRootTenant()? true : editScreen}
/>
{errors?.emailAddress && (
<ErrorMessage
Expand All @@ -776,7 +776,7 @@ const UserProfile = ({ stateCode, userType, cityDetails }) => {

<LabelFieldPair>
<div style={{ width: "100%" }}>
{changepassword == false ? (
{changepassword == false && !Digit.Utils.getOTPBasedLogin()? (
<Button
label={t("CORE_COMMON_CHANGE_PASSWORD")}
variation={"teritiary"}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const SingleInput = ({ isFocus, onChange, onFocus, value, ...rest }) => {
onChange={onChange}
onFocus={onFocus}
ref={inputRef}
type="number"
type="text"
value={value ? value : ""}
{...rest}
/>
Expand All @@ -29,7 +29,7 @@ const OTPInput = (props) => {
const [activeInput, setActiveInput] = useState(0);

const isInputValueValid = (value) => {
return typeof value === "string" && value.trim().length === 1;
return /^[0-9]$/.test(value);
};

const changeCodeAtFocus = (value) => {
Expand Down Expand Up @@ -60,9 +60,12 @@ const OTPInput = (props) => {

function inputChange(event) {
const { value } = event.target;
changeCodeAtFocus(value);

if (isInputValueValid(value)) {
changeCodeAtFocus(value);
focusNextInput();
} else if (value === "") {
changeCodeAtFocus(""); // Handle clearing the input
}
}

Expand Down

0 comments on commit 49481a4

Please sign in to comment.