From 07e7e1eb8762c65ae6b6dfadd5108a94e51992b6 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Thu, 2 Mar 2023 18:30:38 -0500 Subject: [PATCH] Adding 2FA support. Fixes #938 (#939) * Adding 2FA support. Fixes #938 * Updating totp_2fa names. --- package.json | 2 +- src/shared/components/home/login.tsx | 45 +++++++++++++- src/shared/components/person/settings.tsx | 71 +++++++++++++++++++++++ src/shared/utils.ts | 1 + yarn.lock | 8 +-- 5 files changed, 119 insertions(+), 8 deletions(-) diff --git a/package.json b/package.json index 839a3d8..26f10e9 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "inferno-server": "^8.0.6", "isomorphic-cookie": "^1.2.4", "jwt-decode": "^3.1.2", - "lemmy-js-client": "0.17.2-rc.1", + "lemmy-js-client": "0.17.2-rc.3", "markdown-it": "^13.0.1", "markdown-it-container": "^3.0.0", "markdown-it-footnote": "^3.0.3", diff --git a/src/shared/components/home/login.tsx b/src/shared/components/home/login.tsx index 7cdde92..dea6484 100644 --- a/src/shared/components/home/login.tsx +++ b/src/shared/components/home/login.tsx @@ -26,8 +26,10 @@ interface State { form: { username_or_email?: string; password?: string; + totp_2fa_token?: string; }; loginLoading: boolean; + showTotp: boolean; siteRes: GetSiteResponse; } @@ -38,6 +40,7 @@ export class Login extends Component { state: State = { form: {}, loginLoading: false, + showTotp: false, siteRes: this.isoData.site_res, }; @@ -141,6 +144,28 @@ export class Login extends Component { + {this.state.showTotp && ( +
+ +
+ +
+
+ )}
+ {this.totpSection()}