A fully open source & end-to-end encrypted note taking alternative to Evernote.
TypeScript asp-net-coredotnet-coreelectronfosshacktoberfestnote-managmentnote-takingnote-taking-appnotebooknotesnotes-appopen-sourceopensourceprivacyproductivityreactreact-nativereactjsself-hosted
web: allow changing primary 2fa method
Abdullah Atta8cb3cb6b197a
diff --git a/apps/web/src/components/dialogs/mfa/steps.tsx b/apps/web/src/components/dialogs/mfa/steps.tsxindex 4d8f63c6f..1dae4427c 100644--- a/apps/web/src/components/dialogs/mfa/steps.tsx+++ b/apps/web/src/components/dialogs/mfa/steps.tsx@@ -297,7 +297,7 @@ function ChooseAuthenticator(props: ChooseAuthenticatorProps) {) : (false)}- <Text variant="body" mt={1} sx={{ fontWeight: "normal" }}>+ <Text as="div" variant="body" mt={1} sx={{ fontWeight: "normal" }}>{auth.subtitle}</Text></Text>diff --git a/apps/web/src/views/settings.js b/apps/web/src/views/settings.jsindex 52c0f68ad..85fd26724 100644--- a/apps/web/src/views/settings.js+++ b/apps/web/src/views/settings.js@@ -373,81 +373,57 @@ function Settings() {setGroups((g) => ({ ...g, mfa: !g.mfa }));}}/>- {groups.mfa &&- (user.mfa.isEnabled ? (- <>- <Button- variant="list"- onClick={async () => {- if (await verifyAccount()) {- await showMultifactorDialog(user.mfa.primaryMethod);- await refreshUser();- }- }}- >- <Tip- text={- user.mfa.secondaryMethod- ? "Reconfigure fallback 2FA method"- : "Add fallback 2FA method"- }- tip="You can use the fallback 2FA method in case you are unable to login via the primary method."- />- </Button>+ {groups.mfa && (+ <>+ <Button+ variant="list"+ onClick={async () => {+ if (await verifyAccount()) {+ await showMultifactorDialog();+ await refreshUser();+ }+ }}+ >+ <Tip+ text={"Change primary 2FA method"}+ tip={`Your current primary 2FA method is ${user.mfa.primaryMethod}.`}+ />+ </Button>+ <Button+ variant="list"+ onClick={async () => {+ if (await verifyAccount()) {+ await showMultifactorDialog(user.mfa.primaryMethod);+ await refreshUser();+ }+ }}+ >+ <Tip+ text={+ user.mfa.secondaryMethod+ ? "Reconfigure fallback 2FA method"+ : "Add fallback 2FA method"+ }+ tip="You can use the fallback 2FA method in case you are unable to login via the primary method."+ />+ </Button>- <Button- variant="list"- onClick={async () => {- if (await verifyAccount()) {- await show2FARecoveryCodesDialog(- user.mfa.primaryMethod- );- await refreshUser();- }- }}- >- <Tip- text="View recovery codes"- tip={`Recovery codes can be used to login in case you cannot use any of the other 2FA methods. You have ${user.mfa.remainingValidCodes} recovery codes left.`}- />- </Button>- <Button- variant="list"- onClick={async () => {- if (await verifyAccount()) {- await db.mfa.disable();- showToast(- "success",- "Two-factor authentication disabled."- );- await refreshUser();- }- }}- >- <Tip- text="Disable two-factor authentication"- tip="You can disable 2FA if you want to reset or change 2FA settings."- />- </Button>- </>- ) : (- <>- <Button- variant="list"- onClick={async () => {- if (await verifyAccount()) {- await showMultifactorDialog();- await refreshUser();- }- }}- >- <Tip- text="Enable two-factor authentication"- tip="Two-factor authentication adds an additional layer of security to your account by requiring more than just a password to sign in."- />- </Button>- </>- ))}+ <Button+ variant="list"+ onClick={async () => {+ if (await verifyAccount()) {+ await show2FARecoveryCodesDialog(user.mfa.primaryMethod);+ await refreshUser();+ }+ }}+ >+ <Tip+ text="View recovery codes"+ tip={`Recovery codes can be used to login in case you cannot use any of the other 2FA methods. You have ${user.mfa.remainingValidCodes} recovery codes left.`}+ />+ </Button>+ </>+ )}</>)}{isLoggedIn && (