Skip to content

Commit 75e0b62

Browse files
2 parents 641122a + 71be276 commit 75e0b62

File tree

9 files changed

+27
-8
lines changed

9 files changed

+27
-8
lines changed

README.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ This repository also provides one such platform where contributors come over and
9292

9393
### Visit https://palettegram.vercel.app to see the live demo!
9494

95+
### Demo Credentials to test applications:
96+
97+
|Email Address| Password|
98+
|--------|--------------|
99+
|demo@gmail.com|SharePassword@101|
100+
101+
95102
## 👋 Introduction
96103

97104
Palettegram is a social media application dedicated to professionals like graphic designers, UI/UX designers, Developers, etc. to leverage UI designs, design ideas, UX approaches, and color palettes.

public/assets/img-1.png

455 KB
Loading

public/assets/img-2.png

388 KB
Loading

public/assets/img-3.png

263 KB
Loading

public/assets/imgA.png

-478 KB
Binary file not shown.

public/assets/imgB.png

-217 KB
Binary file not shown.

public/assets/imgC.png

-362 KB
Binary file not shown.

src/components/pages/auth/login/index.tsx

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ import { saveUserToStore } from "@/redux/reducers/authReducer";
1212
import { toastify } from "@/helper/toastify";
1313

1414
// API
15-
import { login, loginWithGithub, logoutUser } from "@/backend/auth.api";
15+
import { login, loginWithGithub } from "@/backend/auth.api";
1616

1717
// Icons
1818
import { userCollectionDB } from "@/types/auth";
1919
import { setCookie } from "nookies";
2020

21+
const disallowedPasswordRegex: RegExp = /[^A-Za-z\d@_!#$%^&]/;
22+
const passwordRegex: RegExp = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@_!#$%^&])[A-Za-z\d@_!#$%^&]{6,24}$/;
23+
24+
2125
export default function LoginComponent() {
2226
const [isLoading, setIsLoading] = useState(false);
2327
const [showPassword, setShowPassword] = useState(false);
@@ -44,14 +48,22 @@ export default function LoginComponent() {
4448
try {
4549
setIsLoading(true);
4650

47-
if (data.password.length < 6 || data.password.length > 16) {
48-
throw new Error("Password should be in range of 6 to 16 characters");
49-
}
50-
5151
if (data.email === "" || data.password === "") {
5252
throw new Error("Email and Password fields should be filled");
5353
}
5454

55+
if (data.password.length < 6 || data.password.length > 24) {
56+
throw new Error("Password should be in range of 6 to 24 characters");
57+
}
58+
59+
if (disallowedPasswordRegex.test(data.password)) {
60+
throw new Error("Invalid password. Only the following special characters are allowed: @, _, !, #, $, %, ^, &");
61+
}
62+
63+
if (!passwordRegex.test(data.password)) {
64+
throw new Error("password format not matched");
65+
}
66+
5567
const resp = await login(data.email, data.password);
5668

5769
if (resp && resp.email === data.email) {

src/components/pages/home/index.tsx

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
9999
}}
100100
>
101101
<Image
102-
src="/assets/imgA.png"
102+
src="/assets/img-1.png"
103103
alt="What is palettegram section"
104104
loading="lazy"
105105
width={600}
@@ -185,7 +185,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
185185
}}
186186
>
187187
<Image
188-
src="/assets/imgB.png"
188+
src="/assets/img-2.png"
189189
alt="Who is palettegram for section"
190190
loading="lazy"
191191
width={600}
@@ -210,7 +210,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
210210
}}
211211
>
212212
<Image
213-
src="/assets/imgC.png"
213+
src="/assets/img-3.png"
214214
alt="What you can do section"
215215
loading="lazy"
216216
width={600}

0 commit comments

Comments
 (0)