From 63585eed5d451543d2780db047c1f9917c18f134 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Wed, 2 Jan 2019 11:31:05 +0100 Subject: [PATCH 1/4] start bugfix --- scm-ui/public/locales/en/commons.json | 3 ++- scm-ui/src/containers/Login.js | 16 ++++++++++++++-- 2 files changed, 16 insertions(+), 3 deletions(-) diff --git a/scm-ui/public/locales/en/commons.json b/scm-ui/public/locales/en/commons.json index 2908a38a4f..3196f3a328 100644 --- a/scm-ui/public/locales/en/commons.json +++ b/scm-ui/public/locales/en/commons.json @@ -22,7 +22,8 @@ "error-notification": { "prefix": "Error", "loginLink": "You can login here again.", - "timeout": "The session has expired." + "timeout": "The session has expired.", + "wrong-login-credentials": "Invalid credentials" }, "loading": { "alt": "Loading ..." diff --git a/scm-ui/src/containers/Login.js b/scm-ui/src/containers/Login.js index 8a06478045..60a7579072 100644 --- a/scm-ui/src/containers/Login.js +++ b/scm-ui/src/containers/Login.js @@ -15,7 +15,8 @@ import { InputField, SubmitButton, ErrorNotification, - Image + Image, + UNAUTHORIZED_ERROR } from "@scm-manager/ui-components"; import classNames from "classnames"; import { getLoginLink } from "../modules/indexResource"; @@ -92,18 +93,29 @@ class Login extends React.Component { return !this.isValid(); } + areCredentialsInvalid() { + const { t, error } = this.props; + if (error === UNAUTHORIZED_ERROR) { + return new Error(t("login.wrong-login-credentials")); + } else { + return error; + } + } + renderRedirect = () => { const { from } = this.props.location.state || { from: { pathname: "/" } }; return ; }; render() { - const { authenticated, loading, error, t, classes } = this.props; + const { authenticated, loading, t, classes } = this.props; if (authenticated) { return this.renderRedirect(); } + const error = this.areCredentialsInvalid(); + return (
From 4244e00552ab8d8e7a43d3048a9ac837a8483389 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Wed, 2 Jan 2019 11:32:43 +0100 Subject: [PATCH 2/4] use correct translation --- scm-ui/src/containers/Login.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scm-ui/src/containers/Login.js b/scm-ui/src/containers/Login.js index 60a7579072..142b623229 100644 --- a/scm-ui/src/containers/Login.js +++ b/scm-ui/src/containers/Login.js @@ -96,7 +96,7 @@ class Login extends React.Component { areCredentialsInvalid() { const { t, error } = this.props; if (error === UNAUTHORIZED_ERROR) { - return new Error(t("login.wrong-login-credentials")); + return new Error(t("error-notification.wrong-login-credentials")); } else { return error; } From dce0a8996e5fc7d21bbb6a8a02af3564bcb5e8f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maren=20S=C3=BCwer?= Date: Wed, 2 Jan 2019 11:33:31 +0100 Subject: [PATCH 3/4] refactoring --- scm-ui/src/containers/Login.js | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/scm-ui/src/containers/Login.js b/scm-ui/src/containers/Login.js index 142b623229..e8c5352d58 100644 --- a/scm-ui/src/containers/Login.js +++ b/scm-ui/src/containers/Login.js @@ -114,8 +114,6 @@ class Login extends React.Component { return this.renderRedirect(); } - const error = this.areCredentialsInvalid(); - return (
@@ -131,7 +129,7 @@ class Login extends React.Component { alt={t("login.logo-alt")} /> - +
Date: Wed, 2 Jan 2019 14:59:54 +0000 Subject: [PATCH 4/4] Close branch bugfix/correct_error_message_when_password_is_wrong