From d22152eefd408da84973ef0bffec6ee1d0234bc8 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 1 Jul 2020 21:48:29 -0400 Subject: [PATCH] Adding a math check for logins (until we get a proper captcha). --- ui/src/components/login.tsx | 49 +++++++++++++++++++++++++++++++++++-- ui/translations/en.json | 3 ++- 2 files changed, 49 insertions(+), 3 deletions(-) diff --git a/ui/src/components/login.tsx b/ui/src/components/login.tsx index ce04d0d4f..978993458 100644 --- a/ui/src/components/login.tsx +++ b/ui/src/components/login.tsx @@ -20,6 +20,11 @@ interface State { loginLoading: boolean; registerLoading: boolean; enable_nsfw: boolean; + mathQuestion: { + a: number; + b: number; + answer: number; + }; } export class Login extends Component { @@ -40,6 +45,11 @@ export class Login extends Component { loginLoading: false, registerLoading: false, enable_nsfw: undefined, + mathQuestion: { + a: Math.floor(Math.random() * 10) + 1, + b: Math.floor(Math.random() * 10) + 1, + answer: undefined, + }, }; constructor(props: any, context: any) { @@ -215,6 +225,23 @@ export class Login extends Component { /> +
+ + +
+ +
+
{this.state.enable_nsfw && (
@@ -235,7 +262,11 @@ export class Login extends Component { )}
-