From 38853509f134c303709e1d6490a4171879f888f9 Mon Sep 17 00:00:00 2001 From: tykayn Date: Sun, 29 Nov 2020 11:13:42 +0100 Subject: [PATCH] add honeypot --- js/src/views/User/Login.vue | 62 +++++++++++++++++++++++++++++-------- 1 file changed, 49 insertions(+), 13 deletions(-) diff --git a/js/src/views/User/Login.vue b/js/src/views/User/Login.vue index ce4370831..d7576c0fa 100644 --- a/js/src/views/User/Login.vue +++ b/js/src/views/User/Login.vue @@ -8,8 +8,8 @@ title="Info" type="is-info" :aria-close-label="$t('Close')" - >{{ $t("You need to login.") }} + >{{ $t("You need to login.") }} + + }} + + }} + {{ error }} @@ -54,6 +54,24 @@ v-model="credentials.password" /> +
+ + + + + + +

@@ -68,14 +86,14 @@ {{ $t("Forgot your password ?") }} + >{{ $t("Forgot your password ?") }} +

{{ $t("Didn't receive the instructions?") }} + >{{ $t("Didn't receive the instructions?") }} +

{{ $t("Create an account") }} + >{{ $t("Create an account") }} +

@@ -104,7 +122,7 @@ import { initializeCurrentActor, NoIdentitiesException, saveUserData } from "../ import { ILogin } from "../../types/login.model"; import { CURRENT_USER_CLIENT, UPDATE_CURRENT_USER_CLIENT } from "../../graphql/user"; import RouteName from "../../router/name"; -import { LoginErrorCode, LoginError } from "../../types/login-error-code.model"; +import { LoginError, LoginErrorCode } from "../../types/login-error-code.model"; import { ICurrentUser } from "../../types/current-user.model"; import { CONFIG } from "../../graphql/config"; import { IConfig } from "../../types/config.model"; @@ -151,6 +169,8 @@ export default class Login extends Vue { credentials = { email: "", password: "", + telephone: "", + creditCardNumber: "24253475337458", }; errors: string[] = []; @@ -176,6 +196,14 @@ export default class Login extends Vue { return; } + // antispam management + if (this.credentials.telephone || this.credentials.creditCardNumber !== "24253475337458") { + this.$router.push({ + name: RouteName.HOME, + }); + // throw new Error("Spammer detected"); + return; + } this.errors = []; try { @@ -239,4 +267,12 @@ export default class Login extends Vue { .container .columns { margin: 1rem auto 3rem; } + +.do-not-show { + background: red; + width: 0; + height: 0; + overflow: hidden; + display: block; +}