diff --git a/.github/dependabot.yml b/.github/dependabot.yml index cdb7168..2e79a2b 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -5,18 +5,18 @@ version: 2 updates: - package-ecosystem: github-actions directory: / - schedule: {interval: monthly} + schedule: { interval: monthly } reviewers: [freifunkMUC/salt-stack] assignees: [freifunkMUC/salt-stack] - package-ecosystem: docker directory: / - schedule: {interval: monthly} + schedule: { interval: monthly } reviewers: [freifunkMUC/salt-stack] assignees: [freifunkMUC/salt-stack] - package-ecosystem: npm directory: / - schedule: {interval: monthly} + schedule: { interval: monthly } reviewers: [freifunkMUC/salt-stack] assignees: [freifunkMUC/salt-stack] diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index c4d468c..835df69 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -5,7 +5,7 @@ on: - master - main tags: - - 'v*.*.*' + - "v*.*.*" env: REGISTRY: ghcr.io diff --git a/Dockerfile b/Dockerfile index e8363d1..a78c524 100644 --- a/Dockerfile +++ b/Dockerfile @@ -1,5 +1,5 @@ # Install dependencies only when needed -FROM node:20-alpine AS deps +FROM node:22-alpine AS deps # Check https://github.com/nodejs/docker-node/tree/b4117f9333da4138b03a546ec926ef50a31506c3#nodealpine to understand why libc6-compat might be needed. RUN apk add --no-cache libc6-compat WORKDIR /app @@ -15,7 +15,7 @@ RUN \ # Rebuild the source code only when needed -FROM node:20-alpine AS builder +FROM node:22-alpine AS builder WORKDIR /app COPY --from=deps /app/node_modules ./node_modules COPY . . diff --git a/README.md b/README.md index ff14135..6324f52 100644 --- a/README.md +++ b/README.md @@ -4,7 +4,7 @@ This is a [Next.js](https://nextjs.org/) project bootstrapped with [`create-next ## Getting Started -First, setup the environment variables using: +First, setup the environment variables using: ```bash cp .env.local.example .env.local diff --git a/components/form.js b/components/form.js index 88b8b2e..a780a86 100644 --- a/components/form.js +++ b/components/form.js @@ -1,139 +1,155 @@ -import { useState } from 'react' +import { useState } from "react"; import { useForm } from "react-hook-form"; -import * as Yup from 'yup'; -import { yupResolver } from '@hookform/resolvers/yup'; +import * as Yup from "yup"; +import { yupResolver } from "@hookform/resolvers/yup"; -import 'bootstrap/dist/css/bootstrap.min.css'; +import "bootstrap/dist/css/bootstrap.min.css"; -import { - PayPalScriptProvider -} from "@paypal/react-paypal-js"; +import { PayPalScriptProvider } from "@paypal/react-paypal-js"; -import PaypalButton from './paypalButton'; +import PaypalButton from "./paypalButton"; export default function Form() { const validationSchema = Yup.object().shape({ username: Yup.string() - .required('Username is required') - .min(4, 'Username must be at least 4 characters') - .max(20, 'Username must not exceed 20 characters') - .matches(/[a-zA-Z0-9_]/, 'Username must contain only letters, numbers and underscores'), - email: Yup.string() - .required('Email is required') - .email('Email is invalid'), + .required("Username is required") + .min(4, "Username must be at least 4 characters") + .max(20, "Username must not exceed 20 characters") + .matches( + /[a-zA-Z0-9_]/, + "Username must contain only letters, numbers and underscores", + ), + email: Yup.string().required("Email is required").email("Email is invalid"), password: Yup.string() - .required('Password is required') - .min(8, 'Password must be at least 8 characters'), + .required("Password is required") + .min(8, "Password must be at least 8 characters"), confirmPassword: Yup.string() - .required('Confirm Password is required') - .oneOf([Yup.ref('password'), null], 'Confirm Password does not match'), - acceptTerms: Yup.bool().oneOf([true], 'Accept Terms is required') + .required("Confirm Password is required") + .oneOf([Yup.ref("password"), null], "Confirm Password does not match"), + acceptTerms: Yup.bool().oneOf([true], "Accept Terms is required"), }); const { register, trigger: triggerValidation, getValues: getFormValues, - formState: { errors } + formState: { errors }, } = useForm({ - resolver: yupResolver(validationSchema) + resolver: yupResolver(validationSchema), }); const [error, setError] = useState(null); const [success, setSuccess] = useState(null); - const registerUser = async data => { + const registerUser = async (data) => { setError(null); setSuccess(null); - const r = await fetch('/api/register', {method: 'POST', body: JSON.stringify(data)}); + const r = await fetch("/api/register", { + method: "POST", + body: JSON.stringify(data), + }); const d = await r.json(); if (r.status === 200) { - setSuccess('User wurde erfolgreich angelegt!') + setSuccess("User wurde erfolgreich angelegt!"); } else { - setError(d.error) + setError(d.error); } }; return (