Skip to content

Commit d07e13c

Browse files
zenocrossChristopherAlphonse
authored andcommitted
fix: update password placeholder in ToggleVisibilityInput
1 parent ae24aa8 commit d07e13c

File tree

5 files changed

+23
-13
lines changed

5 files changed

+23
-13
lines changed

.github/ISSUE_TEMPLATE/config.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
blank_issues_enabled: false
1+
blank_issues_enabled: true
22
contact_links:
33
- name: Questions?
44
url: https://github.com/Dokploy/dokploy/discussions
5-
about: Ask your questions here.
5+
about: Ask your questions here.

apps/dokploy/components/dashboard/application/advanced/security/handle-security.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ import { useEffect, useState } from "react";
2525
import { useForm } from "react-hook-form";
2626
import { toast } from "sonner";
2727
import { z } from "zod";
28+
import { ToggleVisibilityInput } from "../../../../shared/toggle-visibility-input";
2829

2930
const AddSecuritychema = z.object({
3031
username: z.string().min(1, "Username is required"),
@@ -151,7 +152,7 @@ export const HandleSecurity = ({
151152
<FormItem>
152153
<FormLabel>Password</FormLabel>
153154
<FormControl>
154-
<Input placeholder="test" {...field} />
155+
<ToggleVisibilityInput placeholder="password" {...field} />
155156
</FormControl>
156157

157158
<FormMessage />

apps/dokploy/components/dashboard/application/advanced/security/show-security.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,12 @@ import { api } from "@/utils/api";
1111
import { LockKeyhole, Trash2 } from "lucide-react";
1212
import { toast } from "sonner";
1313
import { HandleSecurity } from "./handle-security";
14-
14+
import { PASSWORD_RANGE } from "../../../../../pages/register";
1515
interface Props {
1616
applicationId: string;
1717
}
1818

19+
1920
export const ShowSecurity = ({ applicationId }: Props) => {
2021
const { data, refetch } = api.application.one.useQuery(
2122
{
@@ -69,7 +70,9 @@ export const ShowSecurity = ({ applicationId }: Props) => {
6970
<div className="flex flex-col gap-1">
7071
<span className="font-medium">Password</span>
7172
<span className="text-sm text-muted-foreground">
72-
{security.password}
73+
{security.password
74+
? "*".repeat(PASSWORD_RANGE)
75+
: ""}
7376
</span>
7477
</div>
7578
</div>

apps/dokploy/components/shared/toggle-visibility-input.tsx

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ export const ToggleVisibilityInput = ({ ...props }: InputProps) => {
1818
<div className="flex w-full items-center space-x-2">
1919
<Input ref={inputRef} type={inputType} {...props} />
2020
<Button
21+
type="button"
2122
variant={"secondary"}
2223
onClick={() => {
2324
copy(inputRef.current?.value || "");
@@ -26,7 +27,9 @@ export const ToggleVisibilityInput = ({ ...props }: InputProps) => {
2627
>
2728
<Clipboard className="size-4 text-muted-foreground" />
2829
</Button>
29-
<Button onClick={togglePasswordVisibility} variant={"secondary"}>
30+
<Button
31+
type="button"
32+
onClick={togglePasswordVisibility} variant={"secondary"}>
3033
{inputType === "password" ? (
3134
<EyeIcon className="size-4 text-muted-foreground" />
3235
) : (

apps/dokploy/pages/register.tsx

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,36 +23,39 @@ import { type ReactElement, useEffect, useState } from "react";
2323
import { useForm } from "react-hook-form";
2424
import { toast } from "sonner";
2525
import { z } from "zod";
26+
export const MIN_PASSWORD_LENGTH = 8;
27+
const MINIMUM_REQUIRED_LENGTH = 1;
28+
const TIMEOUT_DURATION = 2000;
2629

2730
const registerSchema = z
2831
.object({
29-
name: z.string().min(1, {
32+
name: z.string().min(MINIMUM_REQUIRED_LENGTH , {
3033
message: "Name is required",
3134
}),
3235
email: z
3336
.string()
34-
.min(1, {
37+
.min(MINIMUM_REQUIRED_LENGTH, {
3538
message: "Email is required",
3639
})
3740
.email({
3841
message: "Email must be a valid email",
3942
}),
4043
password: z
4144
.string()
42-
.min(1, {
45+
.min(MINIMUM_REQUIRED_LENGTH, {
4346
message: "Password is required",
4447
})
45-
.refine((password) => password === "" || password.length >= 8, {
48+
.refine((password) => password === "" || password.length >= MIN_PASSWORD_LENGTH, {
4649
message: "Password must be at least 8 characters",
4750
}),
4851
confirmPassword: z
4952
.string()
50-
.min(1, {
53+
.min(MINIMUM_REQUIRED_LENGTH, {
5154
message: "Password is required",
5255
})
5356
.refine(
5457
(confirmPassword) =>
55-
confirmPassword === "" || confirmPassword.length >= 8,
58+
confirmPassword === "" || confirmPassword.length >= MIN_PASSWORD_LENGTH,
5659
{
5760
message: "Password must be at least 8 characters",
5861
},
@@ -102,7 +105,7 @@ const Register = ({ isCloud }: Props) => {
102105
setError(error.message || "An error occurred");
103106
} else {
104107
toast.success("User registered successfuly", {
105-
duration: 2000,
108+
duration: TIMEOUT_DURATION,
106109
});
107110
if (!isCloud) {
108111
router.push("/");

0 commit comments

Comments
 (0)