Skip to content

Commit

Permalink
Merge pull request #522 from bounswe/develop
Browse files Browse the repository at this point in the history
  • Loading branch information
mmtftr authored Nov 19, 2024
2 parents d8bc35d + bf45154 commit c04add4
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 4 deletions.
3 changes: 2 additions & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
FROM node:20-alpine AS build
FROM node:20 AS build
WORKDIR /app
RUN apt-get update && apt-get install -y build-essential libcairo2-dev libpango1.0-dev libjpeg-dev libgif-dev librsvg2-dev

# cache package installs
COPY .yarnrc.yml yarn.lock package.json /app/
Expand Down
4 changes: 2 additions & 2 deletions frontend/src/routes/signup.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ test("signup calls service", async () => {
fireEvent.change(emailField, { target: { value: "[email protected]" } });

const passwordField = screen.getByLabelText("Password");
fireEvent.change(passwordField, { target: { value: "password" } });
fireEvent.change(passwordField, { target: { value: "Password123" } });

const countryField = screen.getByPlaceholderText("TR");
fireEvent.change(countryField, { target: { value: "TR" } });
Expand All @@ -73,7 +73,7 @@ test("signup calls service", async () => {
body: {
username: "john_doe",
email: "[email protected]",
password: "password",
password: "Password123",
firstName: "John",
lastName: "Doe",
country: "TR",
Expand Down
18 changes: 17 additions & 1 deletion frontend/src/routes/signup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,23 @@ const signupSchema = z.object({
lastName: z.string().min(1),
username: z.string().min(1),
email: z.string().email(),
password: z.string().min(8),
password: z
.string()
.min(8)
.refine(
(password) => {
return (
password.length >= 8 &&
/[A-Z]/.test(password) &&
/[a-z]/.test(password) &&
/[0-9]/.test(password)
);
},
{
message:
"Password must contain at least 8 characters, one uppercase letter, one lowercase letter, and one number",
},
),
country: z.string().min(1),
redirectTo: z.string().optional(),
experienceLevel: z.enum(["BEGINNER", "INTERMEDIATE", "ADVANCED"]),
Expand Down

0 comments on commit c04add4

Please sign in to comment.