@@ -9,6 +9,7 @@ import { observer } from "mobx-react";
99import { Eye , EyeOff , XCircle } from "lucide-react" ;
1010// plane imports
1111import { API_BASE_URL , E_PASSWORD_STRENGTH } from "@plane/constants" ;
12+ import { useTranslation } from "@plane/i18n" ;
1213import { Button } from "@plane/propel/button" ;
1314import { AuthService } from "@plane/services" ;
1415import { Input , Spinner , PasswordStrengthIndicator } from "@plane/ui" ;
@@ -41,6 +42,7 @@ const authService = new AuthService();
4142
4243export const AuthPasswordForm = observer ( function AuthPasswordForm ( props : Props ) {
4344 const { email, nextPath, isSMTPConfigured, handleAuthStep, handleEmailClear, mode } = props ;
45+ const { t } = useTranslation ( ) ;
4446 // ref
4547 const formRef = useRef < HTMLFormElement > ( null ) ;
4648 // states
@@ -79,14 +81,11 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
7981
8082 const isButtonDisabled = useMemo (
8183 ( ) =>
82- ! isSubmitting &&
83- ! ! passwordFormData . password &&
84- ( mode === EAuthModes . SIGN_UP
85- ? getPasswordStrength ( passwordFormData . password ) === E_PASSWORD_STRENGTH . STRENGTH_VALID &&
86- passwordFormData . password === passwordFormData . confirm_password
87- : true )
88- ? false
89- : true ,
84+ isSubmitting ||
85+ ! passwordFormData . password ||
86+ ( mode === EAuthModes . SIGN_UP &&
87+ ( getPasswordStrength ( passwordFormData . password ) !== E_PASSWORD_STRENGTH . STRENGTH_VALID ||
88+ passwordFormData . password !== passwordFormData . confirm_password ) ) ,
9089 [ isSubmitting , mode , passwordFormData . confirm_password , passwordFormData . password ]
9190 ) ;
9291
@@ -123,7 +122,7 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
123122 < input type = "hidden" value = { nextPath } name = "next_path" />
124123 < div className = "space-y-1" >
125124 < label className = "text-13 font-medium text-tertiary" htmlFor = "email" >
126- Email
125+ { t ( "space_auth.email" ) }
127126 </ label >
128127 < div className = { `relative flex items-center rounded-md border border-subtle bg-surface-1` } >
129128 < Input
@@ -147,20 +146,19 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
147146
148147 < div className = "space-y-1" >
149148 < label className = "text-13 font-medium text-tertiary" htmlFor = "password" >
150- { mode === EAuthModes . SIGN_IN ? "Password" : "Set a password" }
149+ { mode === EAuthModes . SIGN_IN ? t ( "space_auth.password" ) : t ( "space_auth.set_password" ) }
151150 </ label >
152151 < div className = "relative flex items-center rounded-md bg-surface-1" >
153152 < Input
154153 type = { showPassword ?. password ? "text" : "password" }
155154 name = "password"
156155 value = { passwordFormData . password }
157156 onChange = { ( e ) => handleFormChange ( "password" , e . target . value ) }
158- placeholder = "Enter password"
157+ placeholder = { t ( "space_auth.enter_password" ) }
159158 className = "h-10 w-full border border-subtle !bg-surface-1 pr-12 disable-autofill-style placeholder:text-placeholder"
160159 onFocus = { ( ) => setIsPasswordInputFocused ( true ) }
161160 onBlur = { ( ) => setIsPasswordInputFocused ( false ) }
162161 autoComplete = "off"
163- autoFocus
164162 />
165163 { showPassword ?. password ? (
166164 < EyeOff
@@ -180,15 +178,15 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
180178 { mode === EAuthModes . SIGN_UP && (
181179 < div className = "space-y-1" >
182180 < label className = "text-13 font-medium text-tertiary" htmlFor = "confirm_password" >
183- Confirm password
181+ { t ( "space_auth.confirm_password" ) }
184182 </ label >
185183 < div className = "relative flex items-center rounded-md bg-surface-1" >
186184 < Input
187185 type = { showPassword ?. retypePassword ? "text" : "password" }
188186 name = "confirm_password"
189187 value = { passwordFormData . confirm_password }
190188 onChange = { ( e ) => handleFormChange ( "confirm_password" , e . target . value ) }
191- placeholder = "Confirm password"
189+ placeholder = { t ( "space_auth.confirm_password" ) }
192190 className = "h-10 w-full border border-subtle !bg-surface-1 pr-12 disable-autofill-style placeholder:text-placeholder"
193191 onFocus = { ( ) => setIsRetryPasswordInputFocused ( true ) }
194192 onBlur = { ( ) => setIsRetryPasswordInputFocused ( false ) }
@@ -208,7 +206,9 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
208206 </ div >
209207 { ! ! passwordFormData . confirm_password &&
210208 passwordFormData . password !== passwordFormData . confirm_password &&
211- renderPasswordMatchError && < span className = "text-13 text-danger-primary" > Passwords don{ "'" } t match</ span > }
209+ renderPasswordMatchError && (
210+ < span className = "text-13 text-danger-primary" > { t ( "space_auth.passwords_dont_match" ) } </ span >
211+ ) }
212212 </ div >
213213 ) }
214214
@@ -219,9 +219,9 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
219219 { isSubmitting ? (
220220 < Spinner height = "20px" width = "20px" />
221221 ) : isSMTPConfigured ? (
222- "Continue"
222+ t ( "space_auth.continue" )
223223 ) : (
224- "Go to workspace"
224+ t ( "space_auth.go_to_workspace" )
225225 ) }
226226 </ Button >
227227 { isSMTPConfigured && (
@@ -232,13 +232,13 @@ export const AuthPasswordForm = observer(function AuthPasswordForm(props: Props)
232232 className = "w-full"
233233 size = "xl"
234234 >
235- Sign in with unique code
235+ { t ( "space_auth.sign_in_with_unique_code" ) }
236236 </ Button >
237237 ) }
238238 </ >
239239 ) : (
240240 < Button type = "submit" variant = "primary" className = "w-full" size = "xl" disabled = { isButtonDisabled } >
241- { isSubmitting ? < Spinner height = "20px" width = "20px" /> : "Create account" }
241+ { isSubmitting ? < Spinner height = "20px" width = "20px" /> : t ( "space_auth.create_account" ) }
242242 </ Button >
243243 ) }
244244 </ div >
0 commit comments