mirror of
https://github.com/scm-manager/scm-manager.git
synced 2025-11-17 18:51:10 +01:00
Merged in bugfix/correct_error_message_when_password_is_wrong (pull request #145)
Bugfix/correct error message when password is wrong
This commit is contained in:
@@ -22,7 +22,8 @@
|
|||||||
"error-notification": {
|
"error-notification": {
|
||||||
"prefix": "Error",
|
"prefix": "Error",
|
||||||
"loginLink": "You can login here again.",
|
"loginLink": "You can login here again.",
|
||||||
"timeout": "The session has expired."
|
"timeout": "The session has expired.",
|
||||||
|
"wrong-login-credentials": "Invalid credentials"
|
||||||
},
|
},
|
||||||
"loading": {
|
"loading": {
|
||||||
"alt": "Loading ..."
|
"alt": "Loading ..."
|
||||||
|
|||||||
@@ -15,7 +15,8 @@ import {
|
|||||||
InputField,
|
InputField,
|
||||||
SubmitButton,
|
SubmitButton,
|
||||||
ErrorNotification,
|
ErrorNotification,
|
||||||
Image
|
Image,
|
||||||
|
UNAUTHORIZED_ERROR
|
||||||
} from "@scm-manager/ui-components";
|
} from "@scm-manager/ui-components";
|
||||||
import classNames from "classnames";
|
import classNames from "classnames";
|
||||||
import { getLoginLink } from "../modules/indexResource";
|
import { getLoginLink } from "../modules/indexResource";
|
||||||
@@ -92,13 +93,22 @@ class Login extends React.Component<Props, State> {
|
|||||||
return !this.isValid();
|
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 = () => {
|
renderRedirect = () => {
|
||||||
const { from } = this.props.location.state || { from: { pathname: "/" } };
|
const { from } = this.props.location.state || { from: { pathname: "/" } };
|
||||||
return <Redirect to={from} />;
|
return <Redirect to={from} />;
|
||||||
};
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
const { authenticated, loading, error, t, classes } = this.props;
|
const { authenticated, loading, t, classes } = this.props;
|
||||||
|
|
||||||
if (authenticated) {
|
if (authenticated) {
|
||||||
return this.renderRedirect();
|
return this.renderRedirect();
|
||||||
@@ -119,7 +129,7 @@ class Login extends React.Component<Props, State> {
|
|||||||
alt={t("login.logo-alt")}
|
alt={t("login.logo-alt")}
|
||||||
/>
|
/>
|
||||||
</figure>
|
</figure>
|
||||||
<ErrorNotification error={error} />
|
<ErrorNotification error={this.areCredentialsInvalid()} />
|
||||||
<form onSubmit={this.handleSubmit}>
|
<form onSubmit={this.handleSubmit}>
|
||||||
<InputField
|
<InputField
|
||||||
placeholder={t("login.username-placeholder")}
|
placeholder={t("login.username-placeholder")}
|
||||||
|
|||||||
Reference in New Issue
Block a user