mirror of
https://github.com/mattermost/mattermost.git
synced 2026-08-27 05:37:15 -05:00
Fixed a bug where signup link showed up when signup was disabled (#35769)
* Fixed a bug where signup link showed up when signup was disabled * Removed unused component * fixed test name * CI * fixed a test * fixed a commit --------- Co-authored-by: Mattermost Build <build@mattermost.com>
This commit is contained in:
co-authored by
Mattermost Build
parent
fc9d3be368
commit
010aad6308
@@ -209,12 +209,8 @@ describe('Authentication', () => {
|
||||
// # Go to front page
|
||||
cy.visit('/login');
|
||||
|
||||
// * Assert that create account button is visible
|
||||
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('be.visible').click();
|
||||
|
||||
// * Verify redirection to access problem page since account creation is disabled
|
||||
cy.url().should('include', '/access_problem');
|
||||
cy.findByText('Contact your workspace admin');
|
||||
// * Assert that create account button is not visible
|
||||
cy.findByText('Don\'t have an account?', {timeout: TIMEOUTS.ONE_MIN}).should('not.exist');
|
||||
|
||||
// # Go to sign up with email page
|
||||
cy.visit('/signup_user_complete');
|
||||
|
||||
+2
-3
@@ -36,8 +36,7 @@ describe('Login page with close server', () => {
|
||||
// Restore backed up settings
|
||||
cy.apiAdminLogin().apiUpdateConfig(oldSettings);
|
||||
});
|
||||
it('MM-47222 Should verify access problem page can be reached', () => {
|
||||
cy.findByText('Don\'t have an account?').should('be.visible').click();
|
||||
cy.findByText('Contact your workspace admin').should('be.visible');
|
||||
it('MM-47222 Should verify signup link not visible', () => {
|
||||
cy.findByText('Don\'t have an account?').should('not.exist');
|
||||
});
|
||||
});
|
||||
|
||||
@@ -1,40 +0,0 @@
|
||||
.header-footer-route .header-footer-route-container {
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.AccessProblem {
|
||||
&__body {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
}
|
||||
|
||||
&__title {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
margin: 32px 0 16px 0;
|
||||
color: var(--portal-denim);
|
||||
font-family: 'Metropolis';
|
||||
font-size: 22px;
|
||||
font-style: normal;
|
||||
font-weight: 600;
|
||||
line-height: 28px;
|
||||
text-align: center;
|
||||
}
|
||||
|
||||
&__description {
|
||||
display: flex;
|
||||
max-width: 640px;
|
||||
align-items: center;
|
||||
padding: 0 40px;
|
||||
color: var(--portal-denim);
|
||||
font-family: 'Open Sans';
|
||||
font-size: 14px;
|
||||
font-style: normal;
|
||||
font-weight: 400;
|
||||
line-height: 20px;
|
||||
text-align: center;
|
||||
}
|
||||
}
|
||||
@@ -1,51 +0,0 @@
|
||||
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
||||
// See LICENSE.txt for license information.
|
||||
|
||||
import React, {useCallback, useEffect} from 'react';
|
||||
import {useIntl} from 'react-intl';
|
||||
import {useHistory} from 'react-router-dom';
|
||||
|
||||
import AccessProblemSVG from 'components/common/svg_images_components/access_problem_svg';
|
||||
import type {CustomizeHeaderType} from 'components/header_footer_route/header_footer_route';
|
||||
|
||||
import './access_problem.scss';
|
||||
|
||||
type AccessProblemProps = {
|
||||
onCustomizeHeader?: CustomizeHeaderType;
|
||||
}
|
||||
|
||||
const AccessProblem = ({
|
||||
onCustomizeHeader,
|
||||
}: AccessProblemProps) => {
|
||||
const {formatMessage} = useIntl();
|
||||
const history = useHistory();
|
||||
|
||||
const handleHeaderBackButtonOnClick = useCallback(() => {
|
||||
history.goBack();
|
||||
}, [history]);
|
||||
|
||||
useEffect(() => {
|
||||
if (onCustomizeHeader) {
|
||||
onCustomizeHeader({
|
||||
onBackButtonClick: handleHeaderBackButtonOnClick,
|
||||
});
|
||||
}
|
||||
}, [onCustomizeHeader, handleHeaderBackButtonOnClick]);
|
||||
|
||||
return (
|
||||
<div className='AccessProblem__body'>
|
||||
<AccessProblemSVG
|
||||
width={320}
|
||||
height={190}
|
||||
/>
|
||||
<div className='AccessProblem__title'>
|
||||
{formatMessage({id: 'login.contact_admin.title', defaultMessage: 'Contact your workspace admin'})}
|
||||
</div>
|
||||
<div className='AccessProblem__description'>
|
||||
{formatMessage({id: 'login.contact_admin.detail', defaultMessage: "To access your team's workspace, contact your workspace admin. If you've been invited already, check your email inbox for a Mattermost workspace invite."})}
|
||||
</div>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
export default AccessProblem;
|
||||
@@ -408,6 +408,25 @@ describe('components/login/Login', () => {
|
||||
expect(history.push).toHaveBeenCalledWith(redirectPath);
|
||||
});
|
||||
|
||||
it('should not show dont have an account when open server is disabled', () => {
|
||||
const state = mergeObjects(baseState, {
|
||||
entities: {
|
||||
general: {
|
||||
config: {
|
||||
EnableOpenServer: 'false',
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
renderWithContext(
|
||||
<Login/>,
|
||||
state,
|
||||
);
|
||||
|
||||
expect(screen.queryByText('Don\'t have an account')).not.toBeInTheDocument();
|
||||
});
|
||||
|
||||
describe('EnableGuestMagicLink', () => {
|
||||
it('should show password field when EnableGuestMagicLink is false', async () => {
|
||||
const state = mergeObjects(baseState, {
|
||||
|
||||
@@ -437,23 +437,18 @@ const Login = ({onCustomizeHeader}: LoginProps) => {
|
||||
}, [sessionExpired, formatMessage, onDismissSessionExpired, extraParam, siteName, searchParam]);
|
||||
|
||||
const getAlternateLink = useCallback(() => {
|
||||
if (!showSignup) {
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const linkLabel = formatMessage({
|
||||
id: 'login.noAccount',
|
||||
defaultMessage: 'Don\'t have an account?',
|
||||
});
|
||||
if (showSignup) {
|
||||
return (
|
||||
<AlternateLinkLayout
|
||||
className='login-body-alternate-link'
|
||||
alternateLinkPath={'/signup_user_complete'}
|
||||
alternateLinkLabel={linkLabel}
|
||||
/>
|
||||
);
|
||||
}
|
||||
return (
|
||||
<AlternateLinkLayout
|
||||
className='login-body-alternate-link'
|
||||
alternateLinkPath={'/access_problem'}
|
||||
alternateLinkPath={'/signup_user_complete'}
|
||||
alternateLinkLabel={linkLabel}
|
||||
/>
|
||||
);
|
||||
|
||||
@@ -50,7 +50,6 @@ const MobileViewWatcher = makeAsyncComponent('MobileViewWatcher', lazy(() => imp
|
||||
const WindowSizeObserver = makeAsyncComponent('WindowSizeObserver', lazy(() => import('components/window_size_observer/WindowSizeObserver')));
|
||||
const ErrorPage = makeAsyncComponent('ErrorPage', lazy(() => import('components/error_page')));
|
||||
const Login = makeAsyncComponent('LoginController', lazy(() => import('components/login/login')));
|
||||
const AccessProblem = makeAsyncComponent('AccessProblem', lazy(() => import('components/access_problem')));
|
||||
const PasswordResetSendLink = makeAsyncComponent('PasswordResedSendLink', lazy(() => import('components/password_reset_send_link')));
|
||||
const PasswordResetForm = makeAsyncComponent('PasswordResetForm', lazy(() => import('components/password_reset_form')));
|
||||
const Signup = makeAsyncComponent('SignupController', lazy(() => import('components/signup/signup')));
|
||||
@@ -320,10 +319,6 @@ export default class Root extends React.PureComponent<Props, State> {
|
||||
path={'/login'}
|
||||
component={Login}
|
||||
/>
|
||||
<HFRoute
|
||||
path={'/access_problem'}
|
||||
component={AccessProblem}
|
||||
/>
|
||||
<HFTRoute
|
||||
path={'/reset_password'}
|
||||
component={PasswordResetSendLink}
|
||||
|
||||
@@ -5143,8 +5143,6 @@
|
||||
"login.cardtitle": "Log in",
|
||||
"login.cardtitle.external": "Log in with one of the following:",
|
||||
"login.changed": "Sign-in method changed successfully",
|
||||
"login.contact_admin.detail": "To access your team's workspace, contact your workspace admin. If you've been invited already, check your email inbox for a Mattermost workspace invite.",
|
||||
"login.contact_admin.title": "Contact your workspace admin",
|
||||
"login.createTeam": "Create a team",
|
||||
"login.deactivatedUser": "Your account has been deactivated.",
|
||||
"login.defaultError": "We were unable to log you in. Please enter your details and try again.",
|
||||
|
||||
Reference in New Issue
Block a user