Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Es 1626 #344

Merged
merged 5 commits into from
Sep 10, 2024
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
Original file line number Diff line number Diff line change
Expand Up @@ -73,13 +73,8 @@ export const KycProviderCardLayout = ({
<div className="mt-2.5 kyc-box-header">
{providerName}
</div>
<div className="mt-3">
<div className="kyc-box-subheader-title">
Supported Ids:
</div>
<div className="kyc-box-subheader-detail">Foundation 1, Foundation 2</div>
</div>
</div>

</>
</div>
</div>
Expand Down
4 changes: 2 additions & 2 deletions signup-ui/src/pages/ResetPasswordPage/ResetPasswordPage.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { useCallback, useEffect, useMemo } from "react";
import { yupResolver } from "@hookform/resolvers/yup";
import { isEqual } from "lodash";
import { useCallback, useEffect, useMemo } from "react";
import { Resolver, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import * as yup from "yup";
Expand Down Expand Up @@ -60,7 +60,7 @@ export const ResetPasswordPage = ({ settings }: ResetPasswordPageProps) => {
// Step 1 - UserInfo
yup.object({
username: validateUsername(settings),
fullname: validateFullName(settings),
fullname: validateFullName(settings,t),
captchaToken: validateCaptchaToken(settings),
}),
// Step 2 - Otp
Expand Down
5 changes: 2 additions & 3 deletions signup-ui/src/pages/SignUpPage/SignUpPage.tsx
Original file line number Diff line number Diff line change
@@ -1,12 +1,11 @@
import { useCallback, useEffect, useMemo } from "react";
import { yupResolver } from "@hookform/resolvers/yup";
import { useMutationState } from "@tanstack/react-query";
import { isEqual } from "lodash";
import { useCallback, useEffect, useMemo } from "react";
import { Resolver, useForm } from "react-hook-form";
import { useTranslation } from "react-i18next";
import * as yup from "yup";

import { Button } from "~components/ui/button";
import { Form } from "~components/ui/form";
import { keys as mutationKeys } from "~pages/shared/mutations";
import {
Expand Down Expand Up @@ -88,7 +87,7 @@ export const SignUpPage = ({ settings }: SignUpPageProps) => {
// Step 4 - Account Setup Validation
yup.object({
username: yup.string(),
fullNameInKhmer: validateFullName(settings),
fullNameInKhmer: validateFullName(settings,t),
password: validatePassword(settings),
confirmPassword: validateConfirmPassword("password", settings, true),
consent: yup.bool().oneOf([true], t("terms_and_conditions_validation")),
Expand Down
8 changes: 4 additions & 4 deletions signup-ui/src/pages/shared/validation.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import i18next from "i18next";
import { TFunction } from "i18next";
import * as yup from "yup";

import { SettingsDto } from "~typings/types";
Expand All @@ -21,20 +21,20 @@ export const validateCaptchaToken = (settings: any) =>
settings.response.configs["send-challenge.captcha.required"] &&
yup.string().required("captcha_token_validation");

export const validateFullName = (settings: SettingsDto) =>
export const validateFullName = (settings: SettingsDto, t: TFunction<"translation", undefined>) =>
yup
.string()
.strict(true)
.trim("full_name_all_spaces_validation")
.min(
settings.response.configs["fullname.length.min"],
i18next.t("full_name_min_validation", {
t("full_name_min_validation", {
minLength: settings.response.configs["fullname.length.min"],
})
)
.max(
settings.response.configs["fullname.length.max"],
i18next.t("full_name_max_validation", {
t("full_name_max_validation", {
maxLength: settings.response.configs["fullname.length.max"],
})
)
Expand Down
Loading