mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-10 15:35:49 +01:00
start bugfix
This commit is contained in:
@@ -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 ..."
|
||||
|
||||
@@ -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<Props, State> {
|
||||
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 <Redirect to={from} />;
|
||||
};
|
||||
|
||||
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 (
|
||||
<section className="hero">
|
||||
<div className="hero-body">
|
||||
|
||||
Reference in New Issue
Block a user