diff --git a/frontend/app/components/auth/auth.spec.tsx b/frontend/app/components/auth/auth.spec.tsx
index d8e8051d..7f76b474 100644
--- a/frontend/app/components/auth/auth.spec.tsx
+++ b/frontend/app/components/auth/auth.spec.tsx
@@ -148,6 +148,7 @@ describe('', () => {
expect(container.querySelector('.spinner')).toBeInTheDocument();
await waitFor(() => expect(api.emailSignin).toBeCalled());
+ expect(api.emailSignin).toBeCalledWith('email@email.com', 'username');
expect(container.querySelector('.auth-back-button')).toBeInTheDocument();
expect(container.querySelector('.auth-close-button')).toBeInTheDocument();
@@ -166,7 +167,7 @@ describe('', () => {
StaticStore.config.auth_providers = ['email'];
jest.spyOn(api, 'emailSignin').mockImplementationOnce(async () => null);
- const { container } = render();
+ const { container, getByText } = render();
fireEvent.click(container.querySelector('.auth-button')!);
@@ -188,6 +189,9 @@ describe('', () => {
await waitFor(() => expect(utils.getTokenInvalidReason).toBeCalled());
expect(utils.getTokenInvalidReason).toBeCalledWith('token');
+
+ await waitFor(() => expect(getByText('Token is invalid')).toBeInTheDocument());
+ expect(getByText('Token is invalid').getAttribute('class')).toContain('auth-error');
});
it('should send anonym form', async () => {
diff --git a/frontend/app/components/auth/auth.tsx b/frontend/app/components/auth/auth.tsx
index c9090b75..dc0cfa9e 100644
--- a/frontend/app/components/auth/auth.tsx
+++ b/frontend/app/components/auth/auth.tsx
@@ -103,20 +103,22 @@ const Auth: FunctionComponent = () => {
const errorMessage =
invalidReason !== null && invalidReason in messages ? intl.formatMessage(messages[invalidReason]) : invalidReason;
const isTokenView = view === 'token';
- const submitButton = (
-
+ const formFooterJSX = (
+ <>
+ errorMessage &&
{errorMessage}
+
+ >
);
-
return (
-
+ {formFooterJSX}
>
) : (
<>
@@ -235,7 +227,6 @@ const Auth: FunctionComponent = () => {
))}
)}
-
{
)}
- {errorMessage && {errorMessage}
}
- {submitButton}
+ {formFooterJSX}
>
)}
>