From 6ae9ec07d9d12c7850b2718a0f3b612ef45a6b87 Mon Sep 17 00:00:00 2001 From: Ivan <45982459+ivntsng@users.noreply.github.com> Date: Sun, 10 Nov 2024 22:48:34 -0800 Subject: [PATCH] enhance admin permission checks for moderator and content manager roles (#581) * enhance admin permission checks for moderator and content manager roles * update auth forms with dark theme styling * updated button colors --- frontend/src/components/auth/AuthBlock.tsx | 4 +- frontend/src/components/auth/LoginForm.tsx | 7 +++- .../src/components/auth/SignupWithEmail.tsx | 7 +++- frontend/src/components/pages/Login.tsx | 2 +- frontend/src/components/pages/Logout.tsx | 4 +- frontend/src/components/pages/Signup.tsx | 5 ++- frontend/src/components/ui/Header.tsx | 6 +-- store/app/routers/users.py | 20 ++++------ store/app/security/user.py | 37 ++++++++++++++++--- 9 files changed, 62 insertions(+), 30 deletions(-) diff --git a/frontend/src/components/auth/AuthBlock.tsx b/frontend/src/components/auth/AuthBlock.tsx index 9ecac6e5..a6dccf45 100644 --- a/frontend/src/components/auth/AuthBlock.tsx +++ b/frontend/src/components/auth/AuthBlock.tsx @@ -16,14 +16,14 @@ import { useAlertQueue } from "@/hooks/useAlertQueue"; import { useAuthentication } from "@/hooks/useAuth"; interface AuthBlockProps { - title?: string; + title?: string | React.ReactNode; onClosed?: () => void; signup?: boolean; } const AuthBlock: React.FC = ({ title, onClosed, signup }) => { return ( - +
diff --git a/frontend/src/components/auth/LoginForm.tsx b/frontend/src/components/auth/LoginForm.tsx index f135c1eb..4562e01b 100644 --- a/frontend/src/components/auth/LoginForm.tsx +++ b/frontend/src/components/auth/LoginForm.tsx @@ -60,7 +60,12 @@ const LoginForm = () => { showStrength={false} // Hide password strength bar /> {/* Submit Button */} - + ); }; diff --git a/frontend/src/components/auth/SignupWithEmail.tsx b/frontend/src/components/auth/SignupWithEmail.tsx index 8a02bb47..25007037 100644 --- a/frontend/src/components/auth/SignupWithEmail.tsx +++ b/frontend/src/components/auth/SignupWithEmail.tsx @@ -56,7 +56,12 @@ const SignupWithEmail = () => { {errors?.email && {errors?.email?.message}} {/* Signup Button */} - + ); }; diff --git a/frontend/src/components/pages/Login.tsx b/frontend/src/components/pages/Login.tsx index 41d727d6..1ebd9bb7 100644 --- a/frontend/src/components/pages/Login.tsx +++ b/frontend/src/components/pages/Login.tsx @@ -4,7 +4,7 @@ const Login = () => { return (
- + Welcome back!} />
); diff --git a/frontend/src/components/pages/Logout.tsx b/frontend/src/components/pages/Logout.tsx index 0f4b2b02..6b1a1b64 100644 --- a/frontend/src/components/pages/Logout.tsx +++ b/frontend/src/components/pages/Logout.tsx @@ -24,9 +24,9 @@ const Logout = () => { return (
- + -
+
Logout} /> diff --git a/frontend/src/components/pages/Signup.tsx b/frontend/src/components/pages/Signup.tsx index da2fa14a..4aafaf23 100644 --- a/frontend/src/components/pages/Signup.tsx +++ b/frontend/src/components/pages/Signup.tsx @@ -4,7 +4,10 @@ const Signup = () => { return (
- + Welcome!} + signup + />
); diff --git a/frontend/src/components/ui/Header.tsx b/frontend/src/components/ui/Header.tsx index 2a654c80..0b974866 100644 --- a/frontend/src/components/ui/Header.tsx +++ b/frontend/src/components/ui/Header.tsx @@ -1,7 +1,7 @@ import { FaTimes } from "react-icons/fa"; interface HeaderProps { - title?: string; + title: string | React.ReactNode; label?: string; onClosed?: () => void; } @@ -9,9 +9,7 @@ interface HeaderProps { const Header = ({ title, label, onClosed }: HeaderProps) => { return (
-

- {title ?? "K-Scale Labs"} -

+

{title}

{label &&

{label}

} {onClosed && (