Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion front-js/src/app/auth/login/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ export default function Home() {
<Box align="right">
<Text align="right" margin={{ top: "20px" }} size="15px">
Pas encore de compte ?{" "}
<Link href="/auth/register">S’inscrire</Link>
<Link href="/auth/signup">S’inscrire</Link>
</Text>
</Box>
</form>
Expand Down
81 changes: 81 additions & 0 deletions front-js/src/app/auth/signup/page.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
"use client";

import Box from "@/components/Box";
import Button from "@/components/Button";
import Input from "@/components/Input";
import Layout from "@/components/Layout";
import Modal from "@/components/Modal";
import Title from "@/components/Title";
import Text from "@/components/Text";
import { use, useState } from "react";
import Link from "@/components/Link";
import Space from "@/components/Space";
import ValidatePsw from "@/components/ValidatePsw";
import {validate_passwd} from "./validatePasswd";

export default function Home() {
const [username, setUsername] = useState("");

const [password, setPassword] = useState("");

const [confirmPassword, setConfirmPassword] = useState("")

const isValid = false;

return (
<Layout type="home">
<Box align="center" margin={{ top: "100px", bottom: "50px" }}>
<Title level={1}>Networkers</Title>
</Box>
<Box align="center">
<Modal>
<Title level={3}>Inscription</Title>
<Input
type="text"
placeholder="Nom d'utilisateur"
value={username}
margin={{ bottom: "20px" }}
onChange={(e) => setUsername(e.target.value)}
required
label="Nom d'utilisateur"
/>
<Input
type="password"
placeholder="Password123&"
value={password}
margin={{ bottom: "20px" }}
onChange={(e) => setPassword(e.target.value)}
required
label="Mot de passe"
/>
<Input
type="password"
placeholder="Password123&"
value={confirmPassword}
margin={{ bottom: "20px" }}
onChange={(e) => setConfirmPassword(e.target.value)}
required
label="Confimer mot de passe"
/>
<ValidatePsw
password={password}
/>
<Button
text="Connexion"
primary
type="input"
margin={{ top: "20px" }}
disabled={!username || !password || !confirmPassword || password !== confirmPassword || !validate_passwd(password)}
/>
<Box align="right">
<Text align="right" margin={{ top: "20px" }} size="15px">
Déjà un compte ?{" "}
<Link href="/auth/login">Se connecter</Link>
</Text>
</Box>
</Modal>
</Box>
</Layout>
);
}

23 changes: 23 additions & 0 deletions front-js/src/app/auth/signup/validatePasswd.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
export function validate_passwd(passwd){
if (passwd.length < 8) {
return false;
}

if (!/[0-9]/.test(passwd)) {
return false;
}

if (!/[a-z]/.test(passwd)){
return false;
}

if (!/[A-Z]/.test(passwd)){
return false;
}

if (!/[!@#$%^&*(),.?":{}|<>]/.test(passwd)) {
return false;
}

return true;
}
2 changes: 1 addition & 1 deletion front-js/src/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ export default function Home() {
<Box>
<Button
text="Inscription"
onClick={() => console.log("test")}
onClick={() => router.push("/auth/signup")}
secondary
/>
<Spacer x={4} />
Expand Down
6 changes: 6 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.