From de63a68fd957fc602dc02d345c0f440629fa1481 Mon Sep 17 00:00:00 2001 From: escapedcat Date: Tue, 1 Oct 2024 17:18:56 +0200 Subject: [PATCH] fix(settings): change pw modal usage --- src/pages/Settings/ChangePwModal.tsx | 151 +++++++++++++-------------- 1 file changed, 75 insertions(+), 76 deletions(-) diff --git a/src/pages/Settings/ChangePwModal.tsx b/src/pages/Settings/ChangePwModal.tsx index 2ef4cb09..2d5e6a2e 100644 --- a/src/pages/Settings/ChangePwModal.tsx +++ b/src/pages/Settings/ChangePwModal.tsx @@ -6,7 +6,6 @@ import useCapsLock from "@/hooks/use-caps-lock"; import { checkError } from "@/utils/checkError"; import { instance } from "@/utils/interceptor"; import { Input, useDisclosure } from "@nextui-org/react"; -import { ModalFooter, ModalBody } from "@nextui-org/react"; import { type FC, useState } from "react"; import { useForm } from "react-hook-form"; import { useTranslation } from "react-i18next"; @@ -63,84 +62,84 @@ const ChangePwModal: FC = () => { disclosure={confirmModal} headline={t("settings.change_pw_a")} isLoading={isLoading} - customContent={ -
- - {isCapsLockEnabled && } + custom + > + + + {isCapsLockEnabled && } -
- - - -
-
+
+ - - - - - - } - /> + type="password" + label={t("settings.new_pw")} + isInvalid={!!errors.newPassword} + errorMessage={errors.newPassword?.message} + {...register("newPassword", { + required: t("setup.password_error_empty"), + pattern: { + value: /^[a-zA-Z0-9.-]*$/, + message: t("setup.password_error_chars"), + }, + minLength: { + value: 8, + message: t("setup.password_error_length"), + }, + })} + {...keyHandlers} + /> +
+ + + + + + + +