Skip to content

Commit

Permalink
Small improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
faucomte97 committed Dec 31, 2024
1 parent 61601fa commit df62328
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 15 deletions.
14 changes: 6 additions & 8 deletions src/components/form/UpdateAccountForm.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import * as forms from "codeforlife/components/form"
import { Stack, Typography } from "@mui/material"
import { getDirty, isDirty } from "codeforlife/utils/form"
import { type FC } from "react"
import { LinkButton } from "codeforlife/components/router"
import { Typography } from "@mui/material"
import { useNavigate } from "codeforlife/hooks"

import {
Expand Down Expand Up @@ -159,12 +158,11 @@ const UpdateAccountForm: FC<UpdateAccountFormProps> = ({ user }) => {
placeholder="Enter your current password"
/>
)}
<Stack direction="row" spacing={2} paddingY={3}>
<LinkButton variant="outlined" to={-1}>
Cancel
</LinkButton>
<forms.SubmitButton>Update details</forms.SubmitButton>
</Stack>
<forms.SubmitButton
sx={theme => ({ marginTop: theme.spacing(3) })}

Check warning on line 162 in src/components/form/UpdateAccountForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/form/UpdateAccountForm.tsx#L162

Added line #L162 was not covered by tests
>
Update details
</forms.SubmitButton>
</>
)
}}
Expand Down
9 changes: 7 additions & 2 deletions src/pages/teacherDashboard/account/Account.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@ export interface AccountProps {
const Account: FC<AccountProps> = ({ authUser, view }) => {

Check warning on line 17 in src/pages/teacherDashboard/account/Account.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/teacherDashboard/account/Account.tsx#L17

Added line #L17 was not covered by tests
if (view) {
return {

Check warning on line 19 in src/pages/teacherDashboard/account/Account.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/teacherDashboard/account/Account.tsx#L19

Added line #L19 was not covered by tests
otp: <Setup2FA authUser={authUser} />,
backupTokens: <BackupTokens authUser={authUser} />,
otp: <Setup2FA user={authUser} />,
backupTokens: <BackupTokens user={authUser} />,
}[view]
}

Expand All @@ -31,6 +31,11 @@ const Account: FC<AccountProps> = ({ authUser, view }) => {
<forms.UpdateAccountForm user={authUser} />
</page.Section>
<page.Section boxProps={{ bgcolor: "info.main" }}>
<Typography variant="h5">Two factor authentication</Typography>
<Typography>
Use your smartphone or tablet to enhance your account&apos;s security
by using an authenticator app.
</Typography>
<Manage2FAForm user={authUser} />
</page.Section>
<page.Section>
Expand Down
6 changes: 1 addition & 5 deletions src/pages/teacherDashboard/account/Manage2FAForm.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,6 @@ const Setup2FAForm: FC<{ user: SchoolTeacherUser<RetrieveUserResult> }> = ({
const theme = useTheme()
return (

Check warning on line 17 in src/pages/teacherDashboard/account/Manage2FAForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/teacherDashboard/account/Manage2FAForm.tsx#L15-L17

Added lines #L15 - L17 were not covered by tests
<>
<Typography variant="h5">Two factor authentication</Typography>
<Typography>
Use your smartphone or tablet to enhance your account&apos;s security by
using an authenticator app.
</Typography>
<Button
onClick={() => {
navigate(

Check warning on line 21 in src/pages/teacherDashboard/account/Manage2FAForm.tsx

View check run for this annotation

Codecov / codecov/patch

src/pages/teacherDashboard/account/Manage2FAForm.tsx#L20-L21

Added lines #L20 - L21 were not covered by tests
Expand Down Expand Up @@ -57,6 +52,7 @@ const Edit2FAForm: FC<{ user: SchoolTeacherUser<RetrieveUserResult> }> = ({
<Grid container>
<Grid sm={6} marginTop={theme.spacing(4)}>
<Typography variant="h6">Backup tokens</Typography>
{/*TODO: Update text to show the actual number of backup tokens*/}
<Typography>
If you don&apos;t have your smartphone or tablet with you, you can
access your account using backup tokens. You have 0 backup tokens
Expand Down

0 comments on commit df62328

Please sign in to comment.