Compare commits
22 Commits
821d21a4f9
...
main
| Author | SHA1 | Date | |
|---|---|---|---|
| 62eb7e6e58 | |||
| 7036f29481 | |||
| bf37850e79 | |||
| a9dbbd65a4 | |||
| ca15266fb9 | |||
| e2b97b69e9 | |||
| 59f477c343 | |||
| 7be21969e7 | |||
| db35a7b0c9 | |||
| d2e2286627 | |||
| b8fc47e881 | |||
| 2ec7c63119 | |||
| 6a5ff44135 | |||
| 3546500d9e | |||
| 6cf7bf506a | |||
| 52e1d5f0f8 | |||
| e6267986db | |||
| e6d32bc151 | |||
| 9fd8934439 | |||
| f65a2b30ee | |||
| def1fb9545 | |||
| 1645de206f |
@@ -2,7 +2,7 @@ from fastapi import APIRouter, Depends, HTTPException, Request, Response
|
||||
from sqlalchemy.orm import Session
|
||||
from ..db import get_db
|
||||
from ..models import User
|
||||
from ..security import verify_password, make_session_value, set_session, clear_session, get_session_user_id
|
||||
from ..security import verify_password, make_session_value, set_session, clear_session, get_session_user_id, hash_password
|
||||
|
||||
router = APIRouter(prefix="/auth", tags=["auth"])
|
||||
|
||||
@@ -30,4 +30,23 @@ def me(req: Request, db: Session = Depends(get_db)):
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="not logged in")
|
||||
return {"id": user.id, "email": user.email, "role": user.role}
|
||||
|
||||
|
||||
@router.patch("/password")
|
||||
def set_password(data: dict, req: Request, db: Session = Depends(get_db)):
|
||||
uid = get_session_user_id(req)
|
||||
if not uid:
|
||||
raise HTTPException(status_code=401, detail="not logged in")
|
||||
|
||||
password = data.get("password") or ""
|
||||
if len(password) < 8:
|
||||
raise HTTPException(status_code=400, detail="password too short (min 8)")
|
||||
|
||||
user = db.query(User).filter(User.id == uid, User.disabled == False).first()
|
||||
if not user:
|
||||
raise HTTPException(status_code=401, detail="not logged in")
|
||||
|
||||
user.password_hash = hash_password(password)
|
||||
db.add(user)
|
||||
db.commit()
|
||||
|
||||
return {"ok": True}
|
||||
@@ -13,6 +13,7 @@
|
||||
},
|
||||
"devDependencies": {
|
||||
"@vitejs/plugin-react": "^4.3.1",
|
||||
"vite": "^5.4.8"
|
||||
"vite": "^5.4.8",
|
||||
"vite-plugin-pwa": "^0.20.0"
|
||||
}
|
||||
}
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 48 KiB After Width: | Height: | Size: 47 KiB |
BIN
frontend/public/favicon.ico
Normal file
BIN
frontend/public/favicon.ico
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 341 KiB |
BIN
frontend/public/icons/icon-512.png
Normal file
BIN
frontend/public/icons/icon-512.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 122 KiB |
File diff suppressed because it is too large
Load Diff
@@ -1,5 +1,7 @@
|
||||
import React from "react";
|
||||
import { createRoot } from "react-dom/client";
|
||||
import App from "./App.jsx";
|
||||
import { registerSW } from "virtual:pwa-register";
|
||||
|
||||
createRoot(document.getElementById("root")).render(<App />);
|
||||
registerSW({ immediate: true });
|
||||
|
||||
@@ -1,6 +1,34 @@
|
||||
import { defineConfig } from "vite";
|
||||
import react from "@vitejs/plugin-react";
|
||||
import { VitePWA } from "vite-plugin-pwa";
|
||||
|
||||
export default defineConfig({
|
||||
plugins: [react()],
|
||||
plugins: [
|
||||
react(),
|
||||
VitePWA({
|
||||
registerType: "autoUpdate",
|
||||
includeAssets: [
|
||||
"favicon.ico",
|
||||
"icons/icon-512.png",
|
||||
"marauders-map.jpg" // oder dein Hintergrund
|
||||
],
|
||||
manifest: {
|
||||
name: "Zauber-Detektiv Notizbogen",
|
||||
short_name: "Notizbogen",
|
||||
description: "Cluedo-Magie Sheet",
|
||||
start_url: "/",
|
||||
scope: "/",
|
||||
display: "standalone",
|
||||
background_color: "#1c140d",
|
||||
theme_color: "#caa45a",
|
||||
icons: [
|
||||
{ src: "/icons/icon-512.png", sizes: "512x512", type: "image/png" }
|
||||
]
|
||||
},
|
||||
workbox: {
|
||||
// Caching-Default: die App-Shell wird offline verfügbar
|
||||
globPatterns: ["**/*.{js,css,html,ico,png,jpg,jpeg,svg,webp}"],
|
||||
}
|
||||
})
|
||||
]
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user