From 34c07bfac81229216f2a7f0118f34a82f594cd60 Mon Sep 17 00:00:00 2001 From: Pierre HUBERT Date: Fri, 14 May 2021 11:25:50 +0200 Subject: [PATCH] Display keys in login screen --- src/helpers/AccountHelper.ts | 6 ++++++ src/ui/routes/LoginRoute.tsx | 30 ++++++++++++++++++++++-------- 2 files changed, 28 insertions(+), 8 deletions(-) diff --git a/src/helpers/AccountHelper.ts b/src/helpers/AccountHelper.ts index ff0378c..6a88cbb 100644 --- a/src/helpers/AccountHelper.ts +++ b/src/helpers/AccountHelper.ts @@ -10,8 +10,14 @@ import { } from "../utils/Base64Utils"; import { serverRequest } from "./APIHelper"; +export interface AuthKey { + name: string; + id: number; +} + export interface AuthOptions { reset_token: string; + keys: AuthKey[]; } export interface AdminAccount { diff --git a/src/ui/routes/LoginRoute.tsx b/src/ui/routes/LoginRoute.tsx index 7a5397b..336decb 100644 --- a/src/ui/routes/LoginRoute.tsx +++ b/src/ui/routes/LoginRoute.tsx @@ -217,6 +217,7 @@ class AuthOptionsWidget extends React.Component< this.state = {}; this.loginWithResetToken = this.loginWithResetToken.bind(this); + this.loginWithSecurityKey = this.loginWithSecurityKey.bind(this); } async loginWithResetToken() { @@ -237,6 +238,10 @@ class AuthOptionsWidget extends React.Component< } } + async loginWithSecurityKey(id: number) { + console.info(id); + } + render() { return ( @@ -258,14 +263,23 @@ class AuthOptionsWidget extends React.Component< )} - - - - - - - - + {this.props.options.keys.map((key) => ( + this.loginWithSecurityKey(key.id)} + key={key.id} + > + + + + + + + + ))} );