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..e8c5352d58 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,13 +93,22 @@ class Login extends React.Component { return !this.isValid(); } + areCredentialsInvalid() { + const { t, error } = this.props; + if (error === UNAUTHORIZED_ERROR) { + return new Error(t("error-notification.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(); @@ -119,7 +129,7 @@ class Login extends React.Component { alt={t("login.logo-alt")} /> - +