diff --git a/frontend/src/pages/account/index.tsx b/frontend/src/pages/account/index.tsx index 1248c31d7..0180b23ed 100644 --- a/frontend/src/pages/account/index.tsx +++ b/frontend/src/pages/account/index.tsx @@ -18,6 +18,7 @@ import { Tb2Fa } from "react-icons/tb"; import * as yup from "yup"; import showEnableTotpModal from "../../components/account/showEnableTotpModal"; import ThemeSwitcher from "../../components/account/ThemeSwitcher"; +import Meta from "../../components/Meta"; import useUser from "../../hooks/user.hook"; import authService from "../../services/auth.service"; import userService from "../../services/user.service"; @@ -90,186 +91,192 @@ const Account = () => { } return ( - - - My account - - - - Account Info + <> + <Meta title="My account" /> + <Container size="sm"> + <Title order={3} mb="xs"> + My account -
- userService - .updateCurrentUser({ - username: values.username, - email: values.email, - }) - .then(() => toast.success("User updated successfully")) - .catch(toast.axiosError) - )} - > - - - - - - - -
-
- - - Password - -
- authService - .updatePassword(values.oldPassword, values.password) - .then(() => { - toast.success("Password updated successfully"); - passwordForm.reset(); - }) - .catch(toast.axiosError) - )} - > - - - - - - - -
-
+ + + Account Info + +
+ userService + .updateCurrentUser({ + username: values.username, + email: values.email, + }) + .then(() => toast.success("User updated successfully")) + .catch(toast.axiosError) + )} + > + + + + + + + +
+
+ + + Password + +
+ authService + .updatePassword(values.oldPassword, values.password) + .then(() => { + toast.success("Password updated successfully"); + passwordForm.reset(); + }) + .catch(toast.axiosError) + )} + > + + + + + + + +
+
- - - Security - + + + Security + - - - }> - TOTP - - + + + }> + TOTP + + - - {user.totpVerified ? ( - <> -
{ - authService - .disableTOTP(values.code, values.password) - .then(() => { - toast.success("Successfully disabled TOTP"); - values.password = ""; - values.code = ""; - refreshUser(); - }) - .catch(toast.axiosError); - })} - > - - + + {user.totpVerified ? ( + <> + { + authService + .disableTOTP(values.code, values.password) + .then(() => { + toast.success("Successfully disabled TOTP"); + values.password = ""; + values.code = ""; + refreshUser(); + }) + .catch(toast.axiosError); + })} + > + + - + - - - - - - - ) : ( - <> -
{ - authService - .enableTOTP(values.password) - .then((result) => { - showEnableTotpModal(modals, refreshUser, { - qrCode: result.qrCode, - secret: result.totpSecret, - password: values.password, - }); - values.password = ""; - }) - .catch(toast.axiosError); - })} - > - - - - - - -
- - )} -
-
-
- - - Color scheme - - - -
- - + + + + + ) : ( + <> +
{ + authService + .enableTOTP(values.password) + .then((result) => { + showEnableTotpModal(modals, refreshUser, { + qrCode: result.qrCode, + secret: result.totpSecret, + password: values.password, + }); + values.password = ""; + }) + .catch(toast.axiosError); + })} + > + + + + + + +
+ + )} + + + + + + Color scheme + + + +
+ + - -
- + labels: { confirm: "Delete", cancel: "Cancel" }, + confirmProps: { color: "red" }, + onConfirm: async () => { + await userService.removeCurrentUser(); + window.location.reload(); + }, + }) + } + > + Delete Account + + +
+
+ ); }; diff --git a/frontend/src/pages/admin/config.tsx b/frontend/src/pages/admin/config.tsx index 4d794503f..e92613b03 100644 --- a/frontend/src/pages/admin/config.tsx +++ b/frontend/src/pages/admin/config.tsx @@ -1,9 +1,11 @@ import { Space, Title } from "@mantine/core"; import AdminConfigTable from "../../components/admin/configuration/AdminConfigTable"; +import Meta from "../../components/Meta"; const AdminConfig = () => { return ( <> + Configuration diff --git a/frontend/src/pages/admin/index.tsx b/frontend/src/pages/admin/index.tsx index 70b0d0b22..ce828ed78 100644 --- a/frontend/src/pages/admin/index.tsx +++ b/frontend/src/pages/admin/index.tsx @@ -11,6 +11,7 @@ import { import Link from "next/link"; import { useEffect, useState } from "react"; import { TbRefresh, TbSettings, TbUsers } from "react-icons/tb"; +import Meta from "../../components/Meta"; import configService from "../../services/config.service"; const useStyles = createStyles((theme) => ({ @@ -62,6 +63,7 @@ const Admin = () => { return ( <> + Administration diff --git a/frontend/src/pages/admin/setup.tsx b/frontend/src/pages/admin/setup.tsx index ae7dbe098..ee6c22ab7 100644 --- a/frontend/src/pages/admin/setup.tsx +++ b/frontend/src/pages/admin/setup.tsx @@ -3,6 +3,7 @@ import { useRouter } from "next/router"; import AdminConfigTable from "../../components/admin/configuration/AdminConfigTable"; import Logo from "../../components/Logo"; +import Meta from "../../components/Meta"; import useConfig from "../../hooks/config.hook"; import useUser from "../../hooks/user.hook"; @@ -21,6 +22,7 @@ const Setup = () => { return ( <> + Welcome to Pingvin Share diff --git a/frontend/src/pages/admin/users.tsx b/frontend/src/pages/admin/users.tsx index 2ab3a9a09..eb307beba 100644 --- a/frontend/src/pages/admin/users.tsx +++ b/frontend/src/pages/admin/users.tsx @@ -4,6 +4,7 @@ import { useEffect, useState } from "react"; import { TbPlus } from "react-icons/tb"; import ManageUserTable from "../../components/admin/ManageUserTable"; import showCreateUserModal from "../../components/admin/showCreateUserModal"; +import Meta from "../../components/Meta"; import userService from "../../services/user.service"; import User from "../../types/user.type"; import toast from "../../utils/toast.util"; @@ -47,6 +48,7 @@ const Users = () => { return ( <> + User management diff --git a/frontend/src/pages/user/account.tsx b/frontend/src/pages/user/account.tsx deleted file mode 100644 index db2ea5bf5..000000000 --- a/frontend/src/pages/user/account.tsx +++ /dev/null @@ -1,6 +0,0 @@ -// TODO: Add user account -const Account = () => { - return <div></div>; -}; - -export default Account;