Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

feat: add show/hide password toggle to login page

Devin AIedf1c1f796c8
diff --git a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
index b36dcd2839..a2b0a98321 100644
--- a/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
+++ b/frontend/src/pages/auth/LoginPage/components/InitialStep/InitialStep.tsx
@@ -1,7 +1,7 @@
import { FormEvent, useEffect, useRef, useState } from "react";
import { useTranslation } from "react-i18next";
import { faGithub, faGitlab, faGoogle } from "@fortawesome/free-brands-svg-icons";
-import { faLock } from "@fortawesome/free-solid-svg-icons";
+import { faEye, faEyeSlash, faLock } from "@fortawesome/free-solid-svg-icons";
import { FontAwesomeIcon } from "@fortawesome/react-fontawesome";
import HCaptcha from "@hcaptcha/react-hcaptcha";
import { Link, useNavigate } from "@tanstack/react-router";
@@ -46,6 +46,7 @@ export const InitialStep = ({
const queryParams = new URLSearchParams(window.location.search);
const [captchaToken, setCaptchaToken] = useState("");
const [shouldShowCaptcha, setShouldShowCaptcha] = useState(false);
+ const [showPassword, setShowPassword] = useState(false);
const captchaRef = useRef<HCaptcha>(null);
const { data: serverDetails } = useFetchServerStatus();
@@ -374,12 +375,21 @@ export const InitialStep = ({
<Input
value={password}
onChange={(e) => setPassword(e.target.value)}
- type="password"
+ type={showPassword ? "text" : "password"}
placeholder="Enter your password..."
isRequired
autoComplete="current-password"
id="current-password"
className="select:-webkit-autofill:focus h-10"
+ rightIcon={
+ <button
+ type="button"
+ onClick={() => setShowPassword((prev) => !prev)}
+ className="cursor-pointer text-gray-400"
+ >
+ <FontAwesomeIcon size="sm" icon={showPassword ? faEyeSlash : faEye} />
+ </button>
+ }
/>
</div>
{shouldShowCaptcha && envConfig.CAPTCHA_SITE_KEY && (