Skip to content

Commit e3a23f7

Browse files
committed
fix: 8 symbols code
1 parent bd22a51 commit e3a23f7

12 files changed

Lines changed: 66 additions & 53 deletions

File tree

apps/server-web/package.json

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,9 @@
6666
"@electron/rebuild": "^3.3.0",
6767
"@pmmmwh/react-refresh-webpack-plugin": "^0.5.11",
6868
"@teamsupercell/typings-for-css-modules-loader": "^2.5.2",
69-
"@testing-library/jest-dom": "^6.1.3",
70-
"@testing-library/react": "^14.0.0",
71-
"@types/jest": "^29.5.5",
72-
"@types/react-test-renderer": "^19.1.0",
69+
"@testing-library/jest-dom": "^6.6.3",
70+
"@testing-library/react": "^16.3.2",
71+
"@types/jest": "^29.5.14",
7372
"@types/terser-webpack-plugin": "^5.0.4",
7473
"@types/webpack-bundle-analyzer": "^4.6.0",
7574
"@typescript-eslint/eslint-plugin": "^8.48.1",
@@ -89,11 +88,11 @@
8988
"eslint-import-resolver-typescript": "^3.6.0",
9089
"eslint-import-resolver-webpack": "^0.13.7",
9190
"eslint-plugin-compat": "^4.2.0",
92-
"eslint-plugin-import": "^2.28.1",
93-
"eslint-plugin-jest": "^27.4.0",
94-
"eslint-plugin-jsx-a11y": "^6.7.1",
95-
"eslint-plugin-promise": "^6.1.1",
96-
"eslint-plugin-react": "^7.33.2",
91+
"eslint-plugin-import": "^2.31.0",
92+
"eslint-plugin-jest": "^28.11.0",
93+
"eslint-plugin-jsx-a11y": "^6.10.2",
94+
"eslint-plugin-promise": "^7.2.1",
95+
"eslint-plugin-react": "^7.37.5",
9796
"eslint-plugin-react-hooks": "^6.1.1",
9897
"file-loader": "^6.2.0",
9998
"html-webpack-plugin": "^5.5.3",
@@ -103,7 +102,6 @@
103102
"mini-css-extract-plugin": "^2.7.6",
104103
"prettier": "^3.0.3",
105104
"react-refresh": "^0.14.0",
106-
"react-test-renderer": "^19.2.3",
107105
"rimraf": "^5.0.1",
108106
"sass": "^1.67.0",
109107
"sass-loader": "^13.3.2",
@@ -190,7 +188,7 @@
190188
},
191189
"asar": true,
192190
"npmRebuild": true,
193-
"asarUnpack": "**\\*.{node,dll}",
191+
"asarUnpack": "**/*.{node,dll}",
194192
"files": [
195193
"dist",
196194
"node_modules",

apps/web/app/[locale]/(main)/(teams)/team/join/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import { Button, Text } from '@/core/components';
44
import { AuthCodeInputField } from '@/core/components/auth/auth-code-input';
5+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
56
import { EverCard } from '@/core/components/common/ever-card';
67
import { AuthLayout } from '@/core/components/layouts/default-layout';
78

@@ -23,7 +24,7 @@ const AuthPasscode = () => {
2324
<div className="w-full mt-5">
2425
<AuthCodeInputField
2526
allowedCharacters="alphanumeric"
26-
length={6}
27+
length={AUTH_CODE_LENGTH}
2728
containerClassName="mt-[21px] w-full flex justify-between"
2829
inputClassName="w-[40px] xs:w-[50px]"
2930
onChange={(code) => {

apps/web/core/components/auth/auth-code-input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import React, { MutableRefObject, forwardRef, useState, useEffect, useImperative
66
import { useTranslations } from 'next-intl';
77
import { useCallbackRef } from '@/core/hooks';
88
import { InputField } from '../duplicated-components/_input';
9+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
910

1011
const allowedCharactersValues = ['alpha', 'numeric', 'alphanumeric'] as const;
1112

@@ -77,7 +78,7 @@ export const AuthCodeInputField = forwardRef<AuthCodeRef, AuthCodeProps>(
7778
disabled,
7879
inputClassName,
7980
isPassword = false,
80-
length = 6,
81+
length = AUTH_CODE_LENGTH,
8182
placeholder,
8283
onChange,
8384
defaultValue,

apps/web/core/components/common/unverified-email.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useCallback, useEffect, useState } from 'react';
1010
import { authService } from '@/core/services/client/api/auth/auth.service';
1111
import { emailVerificationService } from '@/core/services/client/api/users/emails/email-verification.service';
1212
import { AuthCodeInputField } from '../auth/auth-code-input';
13+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
1314
import { EverCard } from '../common/ever-card';
1415
import { useRouter } from 'next/navigation';
1516

@@ -121,7 +122,7 @@ export function ConfirmUserModal({
121122
const handleVerifyEmail = useCallback(
122123
(e: React.MouseEvent<HTMLFormElement, MouseEvent>) => {
123124
e.preventDefault();
124-
if (code.length < 6 || !user) return;
125+
if (code.length < AUTH_CODE_LENGTH || !user) return;
125126

126127
queryCall({ code, email: user.email || '' }).finally(() => {
127128
router.refresh();
@@ -142,7 +143,7 @@ export function ConfirmUserModal({
142143
<div className="mt-5 w-full">
143144
<AuthCodeInputField
144145
allowedCharacters="alphanumeric"
145-
length={6}
146+
length={AUTH_CODE_LENGTH}
146147
containerClassName="mt-[21px] w-full flex justify-between"
147148
inputClassName="w-[40px] xs:w-[50px]"
148149
onChange={(code) => {
@@ -173,7 +174,7 @@ export function ConfirmUserModal({
173174
)}
174175
</div>
175176

176-
<Button disabled={code.length < 6 || loading} type="submit" loading={loading}>
177+
<Button disabled={code.length < AUTH_CODE_LENGTH || loading} type="submit" loading={loading}>
177178
{t('common.CONFIRM')}
178179
</Button>
179180
</div>

apps/web/core/components/duplicated-components/auth-code-input.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import { useTranslations } from 'next-intl';
22
import React, { forwardRef, useEffect, useImperativeHandle, useRef } from 'react';
3+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
34

45
const allowedCharactersValues = ['alpha', 'numeric', 'alphanumeric'] as const;
56

@@ -65,7 +66,7 @@ const AuthCodeInput = forwardRef<AuthCodeRef, AuthCodeProps>(
6566
disabled,
6667
inputClassName,
6768
isPassword = false,
68-
length = 6,
69+
length = AUTH_CODE_LENGTH,
6970
placeholder,
7071
onChange
7172
},

apps/web/core/components/features/teams/join-team-modal.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useTranslations } from 'next-intl';
44
import { EverCard } from '../../common/ever-card';
55
import { InputField } from '../../duplicated-components/_input';
66
import { AuthCodeInputField } from '../../auth/auth-code-input';
7+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
78

89
/**
910
* Join team modal
@@ -51,7 +52,7 @@ export function JoinTeamModal({ open, closeModal }: { open: boolean; closeModal:
5152

5253
<AuthCodeInputField
5354
allowedCharacters="alphanumeric"
54-
length={6}
55+
length={AUTH_CODE_LENGTH}
5556
ref={inputCodeRef}
5657
containerClassName="mt-[21px] w-full flex justify-between"
5758
inputClassName="w-[40px] xs:w-[50px]"

apps/web/core/components/features/teams/request-to-join-modal.tsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import { useCallback, useState } from 'react';
1010
import { useTranslations } from 'next-intl';
1111
import { ArrowLeftIcon } from 'assets/svg';
1212
import { AuthCodeInputField } from '@/core/components/auth/auth-code-input';
13+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
1314
import { EverCard } from '@/core/components/common/ever-card';
1415
import { InputField } from '@/core/components/duplicated-components/_input';
1516
import { PositionDropDown } from '../../layouts/default-layout/header/position-dropdown';
@@ -94,7 +95,7 @@ const AlreadyMember = ({ closeModal }: { closeModal: any }) => {
9495
<p className="text-xs text-left text-gray-500">{t('pages.auth.INPUT_INVITE_CODE')}</p>
9596
<AuthCodeInputField
9697
allowedCharacters="alphanumeric"
97-
length={6}
98+
length={AUTH_CODE_LENGTH}
9899
ref={inputCodeRef}
99100
containerClassName="mt-[21px] w-full flex justify-between"
100101
inputClassName="w-[40px] xs:w-[50px]"
@@ -140,7 +141,7 @@ const AlreadyMember = ({ closeModal }: { closeModal: any }) => {
140141
'font-normal rounded-xl border border-primary disabled:border-0 md:min-w-[180px]'
141142
}
142143
loading={loading}
143-
disabled={loading || formValues.code.length !== 6}
144+
disabled={loading || formValues.code.length !== AUTH_CODE_LENGTH}
144145
>
145146
{t('pages.auth.JOIN')}
146147
</Button>
@@ -269,7 +270,7 @@ const BecomeMember = ({ closeModal }: { closeModal: any }) => {
269270
<p className="text-xs text-left text-gray-500">{t('pages.auth.INPUT_INVITE_CODE')}</p>
270271
<AuthCodeInputField
271272
allowedCharacters="alphanumeric"
272-
length={6}
273+
length={AUTH_CODE_LENGTH}
273274
ref={inputCodeRef}
274275
containerClassName="mt-[21px] w-full flex justify-between"
275276
inputClassName="w-[40px] xs:w-[50px]"
@@ -322,7 +323,7 @@ const BecomeMember = ({ closeModal }: { closeModal: any }) => {
322323
disabled={
323324
requestToJoinLoading ||
324325
validateRequestToJoinLoading ||
325-
(joinButtonAction === 'CONFIRM' && formValues.code.length !== 6)
326+
(joinButtonAction === 'CONFIRM' && formValues.code.length !== AUTH_CODE_LENGTH)
326327
}
327328
>
328329
{joinButtonAction === 'JOIN' ? t('common.JOIN_REQUEST') : t('common.CONFIRM')}

apps/web/core/components/features/users/email-reset-modal.tsx

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { useCallback, useEffect, useState } from 'react';
44
import { useForm } from 'react-hook-form';
55
import { useTranslations } from 'next-intl';
66
import { AuthCodeInputField } from '../../auth/auth-code-input';
7+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
78
import { EverCard } from '../../common/ever-card';
89
import { InputField } from '../../duplicated-components/_input';
910

@@ -113,7 +114,7 @@ export function EmailResetModal({ open, closeModal, email }: { open: boolean; cl
113114
<div className="w-full mt-5">
114115
<AuthCodeInputField
115116
allowedCharacters="alphanumeric"
116-
length={6}
117+
length={AUTH_CODE_LENGTH}
117118
containerClassName="mt-[21px] w-full flex justify-between"
118119
inputClassName="w-[40px] xs:w-[50px]"
119120
onChange={(code) => {
@@ -158,7 +159,7 @@ export function EmailResetModal({ open, closeModal, email }: { open: boolean; cl
158159

159160
<Button
160161
type="submit"
161-
disabled={code.length < 6 || verifyChangeEmailRequestLoading}
162+
disabled={code.length < AUTH_CODE_LENGTH || verifyChangeEmailRequestLoading}
162163
loading={verifyChangeEmailRequestLoading}
163164
className={
164165
'font-medium border border-primary disabled:border-0 md:min-w-[180px] rounded-xl'

apps/web/core/components/pages/auth/passcode/page-component.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ import {
3434
import { cn } from '@/core/lib/helpers';
3535
import { ChevronDown } from 'lucide-react';
3636
import { AuthCodeInputField } from '@/core/components/auth/auth-code-input';
37+
import { AUTH_CODE_LENGTH } from '@/core/constants/config/constants';
3738
import { EverCard } from '@/core/components/common/ever-card';
3839
import { InputField } from '@/core/components/duplicated-components/_input';
3940
import { Avatar } from '@/core/components/duplicated-components/avatar';
@@ -240,7 +241,7 @@ function PasscodeScreen({ form, className }: { form: TAuthenticationPasscode } &
240241
inputReference={inputsRef}
241242
key={form.authScreen.screen}
242243
allowedCharacters="alphanumeric"
243-
length={6}
244+
length={AUTH_CODE_LENGTH}
244245
ref={form.inputCodeRef}
245246
containerClassName="mt-[21px] w-full flex justify-between dark:bg-[#25272D]"
246247
inputClassName="w-[40px] xs:w-[50px] pl-[21px] dark:bg-[#25272D]"

apps/web/core/constants/config/constants.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,12 @@ export const MAIN_PICTURE_DARK = process.env.MAIN_PICTURE_DARK || '/assets/cover
292292

293293
export const CHARACTER_LIMIT_TO_SHOW = 20;
294294

295+
/**
296+
* Length of the passwordless / magic authentication code.
297+
* Update this single value when the backend code length changes.
298+
*/
299+
export const AUTH_CODE_LENGTH = 8;
300+
295301
export const smtpConfiguration: () => I_SMTPRequest = () => ({
296302
fromAddress: SMTP_FROM_ADDRESS,
297303
host: SMTP_HOST,

0 commit comments

Comments
 (0)