diff --git a/.gitignore b/.gitignore index ff5f060c..4055c262 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,4 @@ yarn-error.log* # Misc .DS_Store *.pem +.idea/ \ No newline at end of file diff --git a/apps/hub/app/(auth)/login/_components/Login.tsx b/apps/hub/app/(auth)/login/_components/Login.tsx index aded2c2a..7cc50bfe 100644 --- a/apps/hub/app/(auth)/login/_components/Login.tsx +++ b/apps/hub/app/(auth)/login/_components/Login.tsx @@ -1,10 +1,16 @@ 'use client'; import { zodResolver } from '@hookform/resolvers/zod'; import { signIn } from 'next-auth/react'; +import Link from 'next/link'; +import { useState } from 'react'; import { useForm } from 'react-hook-form'; +import { Toaster, toast } from 'react-hot-toast'; import { z } from 'zod'; + export const Login = () => { + const [isLoading, setIsLoading] = useState(false); + const schema = z.object({ email: z.string().email(), password: z.string().min(6), @@ -18,29 +24,91 @@ export const Login = () => { console.log(form.formState.errors); return (
{ + setIsLoading(true); const data = await signIn('credentials', { redirect: false, email: form.getValues('email'), password: form.getValues('password'), }); + if (!data || data.error) { + toast.error("E-Mail / Passwort ist falsch!", + { + style: { + background: 'var(--fallback-b1, oklch(var(--b1) / var(--tw-bg-opacity, 1)))', + color: 'var(--fallback-nc, oklch(var(--nc) / var(--tw-text-opacity, 1)))' + } + } + ) + } console.log(data); + setIsLoading(false); })} > - - - +
+ +
+

Login

+ + Noch keinen Account? Zur{' '} + + Registrierung + + + + +
+ +
); }; diff --git a/apps/hub/app/(auth)/login/page.tsx b/apps/hub/app/(auth)/login/page.tsx index bc0a3ddc..003ec21a 100644 --- a/apps/hub/app/(auth)/login/page.tsx +++ b/apps/hub/app/(auth)/login/page.tsx @@ -1,12 +1,24 @@ -import { Provider } from 'next-auth/providers/index'; -import { getProviders } from 'next-auth/react'; import { Login } from './_components/Login'; export default async () => { return ( -
-

Login

- -
- ); + <> +
+
+
+
+
+ +
+
+
+
+ + ); }; diff --git a/apps/hub/package.json b/apps/hub/package.json index c1262ab1..5fac5fc1 100644 --- a/apps/hub/package.json +++ b/apps/hub/package.json @@ -21,6 +21,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", + "react-hot-toast": "^2.5.1", "tailwind-merge": "^2.6.0", "zod": "^3.24.1" }, diff --git a/package-lock.json b/package-lock.json index 306995ea..2e80acdf 100644 --- a/package-lock.json +++ b/package-lock.json @@ -50,6 +50,7 @@ "react": "^19.0.0", "react-dom": "^19.0.0", "react-hook-form": "^7.54.2", + "react-hot-toast": "^2.5.1", "tailwind-merge": "^2.6.0", "zod": "^3.24.1" }, @@ -2414,8 +2415,7 @@ "node_modules/csstype": { "version": "3.1.3", "resolved": "https://registry.npmjs.org/csstype/-/csstype-3.1.3.tgz", - "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==", - "dev": true + "integrity": "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw==" }, "node_modules/culori": { "version": "3.3.0", @@ -4062,6 +4062,15 @@ "node": ">=8" } }, + "node_modules/goober": { + "version": "2.1.16", + "resolved": "https://registry.npmjs.org/goober/-/goober-2.1.16.tgz", + "integrity": "sha512-erjk19y1U33+XAMe1VTvIONHYoSqE4iS7BYUZfHaqeohLmnC0FdxEh7rQU+6MZ4OajItzjZFSRtVANrQwNq6/g==", + "license": "MIT", + "peerDependencies": { + "csstype": "^3.0.10" + } + }, "node_modules/gopd": { "version": "1.2.0", "resolved": "https://registry.npmjs.org/gopd/-/gopd-1.2.0.tgz", @@ -6657,6 +6666,23 @@ "react": "^16.8.0 || ^17 || ^18 || ^19" } }, + "node_modules/react-hot-toast": { + "version": "2.5.1", + "resolved": "https://registry.npmjs.org/react-hot-toast/-/react-hot-toast-2.5.1.tgz", + "integrity": "sha512-54Gq1ZD1JbmAb4psp9bvFHjS7lje+8ubboUmvKZkCsQBLH6AOpZ9JemfRvIdHcfb9AZXRaFLrb3qUobGYDJhFQ==", + "license": "MIT", + "dependencies": { + "csstype": "^3.1.3", + "goober": "^2.1.16" + }, + "engines": { + "node": ">=10" + }, + "peerDependencies": { + "react": ">=16", + "react-dom": ">=16" + } + }, "node_modules/react-is": { "version": "16.13.1", "resolved": "https://registry.npmjs.org/react-is/-/react-is-16.13.1.tgz", diff --git a/packages/database/.env b/packages/database/.env deleted file mode 100644 index 9320a790..00000000 --- a/packages/database/.env +++ /dev/null @@ -1,7 +0,0 @@ -# Environment variables declared in this file are automatically made available to Prisma. -# See the documentation for more detail: https://pris.ly/d/prisma-schema#accessing-environment-variables-from-the-schema - -# Prisma supports the native connection string format for PostgreSQL, MySQL, SQLite, SQL Server, MongoDB and CockroachDB. -# See the documentation for all the connection string options: https://pris.ly/d/connection-strings - -DATABASE_URL=postgresql://persistant-data:persistant-data-pw@localhost:5432/var \ No newline at end of file diff --git a/packages/database/prisma/schema/schema.prisma b/packages/database/prisma/schema/schema.prisma index 7df96a9e..17820e12 100644 --- a/packages/database/prisma/schema/schema.prisma +++ b/packages/database/prisma/schema/schema.prisma @@ -7,6 +7,7 @@ generator client { provider = "prisma-client-js" previewFeatures = ["prismaSchemaFolder"] + output = "../../generated/client" } datasource db {