Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Sanchitbajaj02 committed May 24, 2024
2 parents 641122a + 71be276 commit 75e0b62
Show file tree
Hide file tree
Showing 9 changed files with 27 additions and 8 deletions.
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ This repository also provides one such platform where contributors come over and

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

### Demo Credentials to test applications:

|Email Address| Password|
|--------|--------------|
|[email protected]|SharePassword@101|


## 👋 Introduction

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.
Expand Down
Binary file added public/assets/img-1.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img-2.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added public/assets/img-3.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file removed public/assets/imgA.png
Binary file not shown.
Binary file removed public/assets/imgB.png
Binary file not shown.
Binary file removed public/assets/imgC.png
Binary file not shown.
22 changes: 17 additions & 5 deletions src/components/pages/auth/login/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,16 @@ import { saveUserToStore } from "@/redux/reducers/authReducer";
import { toastify } from "@/helper/toastify";

// API
import { login, loginWithGithub, logoutUser } from "@/backend/auth.api";
import { login, loginWithGithub } from "@/backend/auth.api";

// Icons
import { userCollectionDB } from "@/types/auth";
import { setCookie } from "nookies";

const disallowedPasswordRegex: RegExp = /[^A-Za-z\d@_!#$%^&]/;
const passwordRegex: RegExp = /^(?=.*[a-zA-Z])(?=.*\d)(?=.*[@_!#$%^&])[A-Za-z\d@_!#$%^&]{6,24}$/;


export default function LoginComponent() {
const [isLoading, setIsLoading] = useState(false);
const [showPassword, setShowPassword] = useState(false);
Expand All @@ -44,14 +48,22 @@ export default function LoginComponent() {
try {
setIsLoading(true);

if (data.password.length < 6 || data.password.length > 16) {
throw new Error("Password should be in range of 6 to 16 characters");
}

if (data.email === "" || data.password === "") {
throw new Error("Email and Password fields should be filled");
}

if (data.password.length < 6 || data.password.length > 24) {
throw new Error("Password should be in range of 6 to 24 characters");
}

if (disallowedPasswordRegex.test(data.password)) {
throw new Error("Invalid password. Only the following special characters are allowed: @, _, !, #, $, %, ^, &");
}

if (!passwordRegex.test(data.password)) {
throw new Error("password format not matched");
}

const resp = await login(data.email, data.password);

if (resp && resp.email === data.email) {
Expand Down
6 changes: 3 additions & 3 deletions src/components/pages/home/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
}}
>
<Image
src="/assets/imgA.png"
src="/assets/img-1.png"
alt="What is palettegram section"
loading="lazy"
width={600}
Expand Down Expand Up @@ -185,7 +185,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
}}
>
<Image
src="/assets/imgB.png"
src="/assets/img-2.png"
alt="Who is palettegram for section"
loading="lazy"
width={600}
Expand All @@ -210,7 +210,7 @@ function HomePage({ accountId }: { accountId: string | undefined }) {
}}
>
<Image
src="/assets/imgC.png"
src="/assets/img-3.png"
alt="What you can do section"
loading="lazy"
width={600}
Expand Down

0 comments on commit 75e0b62

Please sign in to comment.