Skip to content

Commit

Permalink
fix workflow, suppression de code inutile
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexTraveylan committed Sep 25, 2023
1 parent 36bdc58 commit 24b4c73
Show file tree
Hide file tree
Showing 13 changed files with 27 additions and 142 deletions.
6 changes: 6 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,12 @@ jobs:
matrix:
node-version: [16.x]

env:
NEXT_PUBLIC_SUPERMASTERSALT: ${{ secrets.NEXT_PUBLIC_SUPERMASTERSALT }}
DATABASE_URL: ${{ secrets.DATABASE_URL }}
JWT_SECRET: ${{ secrets.JWT_SECRET }}
JWT_REFRESH_SECRET: ${{ secrets.JWT_REFRESH_SECRET }}

steps:
- name: Checkout repository
uses: actions/checkout@v2
Expand Down
6 changes: 3 additions & 3 deletions src/app/view-passwords/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,18 @@ export default async function ViewPasswordsPage() {
const { email, privateKey } = currentUser()

if (!email) return <AccessDenied />
if (!privateKey) throw new Error("Pas de clé privée")
if (!privateKey) throw new Error("Erreur.")

const privateKeyBuffer = Buffer.from(privateKey, "utf-8")

const cUser = await userAppService.getByEmail(email)
if (!cUser) {
throw new Error("Impossible de trouver l'utilisateur.")
throw new Error("Erreur.")
}

const passwords = await guardedPasswordService.getAllGuardedPasswordByUserID(cUser.id)
if (!passwords) {
throw new Error("Echec dans la récupération des mots de passe.")
throw new Error("Erreur.")
}

const passBdds: PassBdd[] = []
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"use client"
import { Button } from "@/ui/Button"
import { Key, User } from "lucide-react"
import { useState } from "react"
import { Key, User } from "../../node_modules/lucide-react"

export function CopyToClipboardButton({ password, btnType }: { password: string; btnType: "user" | "password" }) {
const [isCopied, setIsCopied] = useState(false)
Expand Down
44 changes: 0 additions & 44 deletions src/components/description.tsx

This file was deleted.

2 changes: 1 addition & 1 deletion src/components/footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ export async function Footer() {
return (
<footer className="z-20 w-full border-t border-slate-200">
<div className="flex flex-wrap items-center justify-between max-w-screen-xl p-4 mx-auto">
<div>Beta v 0.5.0</div>
<div>Beta v 0.6.0</div>
<div>{`${formatMouth} ${year}`}</div>
<div>Alex Traveylan</div>
</div>
Expand Down
20 changes: 7 additions & 13 deletions src/components/forms/add-password-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,7 @@ import { useForm } from "react-hook-form"
import { z } from "zod"
import { MinusCircle, RefreshCw, Send } from "../../../node_modules/lucide-react"

export function AddPasswordForm({
setIsShow,
recupPasswords = undefined,
}: {
setIsShow: Dispatch<SetStateAction<boolean>>
recupPasswords: undefined | (() => void)
}) {
export function AddPasswordForm({ setIsShow }: { setIsShow: Dispatch<SetStateAction<boolean>> }) {
const { toast } = useToast()
const router = useRouter()
const form = useForm<z.infer<typeof addPasswordSchema>>({
Expand Down Expand Up @@ -49,6 +43,10 @@ export function AddPasswordForm({

const response = await fetch("/api/get-public-key")
if (!response.ok) {
toast({
description: "Une erreur s'est produite.",
variant: "destructive",
})
return
}

Expand All @@ -67,19 +65,15 @@ export function AddPasswordForm({
})

if (response2.ok) {
if (recupPasswords != undefined) {
recupPasswords()
} else {
router.refresh()
}
setIsShow(false)
toast({
description: "Mot de passe crée avec succes.",
})
router.refresh()
} else {
toast({
variant: "destructive",
description: "Echec dans la création d&aposun nouveau mot de passe.",
description: "Une erreur s'est produite.",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/edit-password-form.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,11 @@ export function EditPassword({ setIsEditing, password }: { setIsEditing: Dispatc
})

if (response2.ok) {
router.refresh()
setIsEditing(false)
toast({
description: "Mot de passe modifié avec succes.",
})
router.refresh()
} else {
toast({
variant: "destructive",
Expand Down
2 changes: 1 addition & 1 deletion src/components/forms/master-form-create.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ export function MasterFormCreate({ setIsSignIn }: { setIsSignIn: (value: boolean
} else {
toast({
variant: "destructive",
description: "Echec !",
description: "Une erreur s'est produite.",
})
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/components/password_card.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
"use client"
import CopyToClipboardButton from "@/components/clipBoardButton"
import CopyToClipboardButton from "@/components/clip-board-button"
import { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@/components/ui/card"
import { useToast } from "@/components/ui/use-toast"
import { PassBdd } from "@/lib/types/types"
Expand Down
10 changes: 5 additions & 5 deletions src/components/passwords-health.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,17 +44,17 @@ export function PasswordsHealthCard({ passBdds }: { passBdds: PassBdd[] }) {
<Card>
<CardHeader>
<CardTitle className="flex justify-between">
<h3>Bilan de sécurité</h3>
<div>Bilan de sécurité</div>
<Radar strokeWidth={1.3} size={23} onClick={findVulnerabilities} className="cursor-pointer transition-colors hover:text-green-500" />
</CardTitle>
<CardDescription>Check fuites et faiblesses des mdp.</CardDescription>
</CardHeader>
{passwordChecked && (
<CardContent className="flex flex-col gap-2">
<div>
<h3>
<div>
{nbCompromised} {pluralize(nbCompromised, "mot")} de passe compromis
</h3>
</div>
<ul>
{vulnerabilities.map((passBdd) => (
<li className="text-red-700 dark:text-red-500 pl-5">
Expand All @@ -64,9 +64,9 @@ export function PasswordsHealthCard({ passBdds }: { passBdds: PassBdd[] }) {
</ul>
</div>
<div>
<h3>
<div>
{nbWeak} {pluralize(nbCompromised, "mot")} de passe {pluralize(nbCompromised, "faible")}
</h3>
</div>
<ul>
{weaks.map((passBdd) => (
<li className="text-orange-600 dark:text-orange-400 pl-5">
Expand Down
2 changes: 1 addition & 1 deletion src/components/shared/input-password-eye.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"use client"

import { Input, InputProps } from "@/components/ui/input"
import React, { useState } from "react"
import { Eye, EyeOff } from "../../../node_modules/lucide-react"
import { Input, InputProps } from "../ui/input"

export const InputEye = React.forwardRef<HTMLInputElement, InputProps>(({ className, type, ...props }, ref) => {
const [isShowPassword, setIsShowPassword] = useState(false)
Expand Down
12 changes: 0 additions & 12 deletions src/components/shared/input.tsx

This file was deleted.

59 changes: 0 additions & 59 deletions src/components/shared/password-input.tsx

This file was deleted.

0 comments on commit 24b4c73

Please sign in to comment.