MM-58793 Apply EnableUserCreation to signup.tsx (#27692)
* update text, apply EnableUserCreation to ui * update text and add unit test * Update webapp/channels/src/components/admin_console/admin_definition.tsx Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> * Update webapp/channels/src/components/admin_console/admin_definition.tsx Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> * Update webapp/channels/src/i18n/en.json Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> * Update webapp/channels/src/i18n/en.json Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com> --------- Co-authored-by: Mattermost Build <build@mattermost.com> Co-authored-by: Carrie Warner (Mattermost) <74422101+cwarnermm@users.noreply.github.com>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
bcf92d3f53
Коммит
8f3a13122f
@@ -3046,7 +3046,7 @@ const AdminDefinition: AdminDefinitionType = {
|
||||
type: 'bool',
|
||||
key: 'TeamSettings.EnableUserCreation',
|
||||
label: defineMessage({id: 'admin.team.userCreationTitle', defaultMessage: 'Enable Account Creation: '}),
|
||||
help_text: defineMessage({id: 'admin.team.userCreationDescription', defaultMessage: 'When false, the ability to create accounts is disabled. The create account button displays error when pressed.'}),
|
||||
help_text: defineMessage({id: 'admin.team.userCreationDescription', defaultMessage: 'When false, the ability to create accounts is disabled, and selecting Create Account displays an error. Applies to Email, OpenID Connect, and OAuth 2.0 user account authentication.'}),
|
||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.AUTHENTICATION.SIGNUP)),
|
||||
},
|
||||
{
|
||||
@@ -3077,7 +3077,7 @@ const AdminDefinition: AdminDefinitionType = {
|
||||
type: 'bool',
|
||||
key: 'TeamSettings.EnableOpenServer',
|
||||
label: defineMessage({id: 'admin.team.openServerTitle', defaultMessage: 'Enable Open Server: '}),
|
||||
help_text: defineMessage({id: 'admin.team.openServerDescription', defaultMessage: 'When true, anyone can signup for a user account on this server without the need to be invited.'}),
|
||||
help_text: defineMessage({id: 'admin.team.openServerDescription', defaultMessage: 'When true, anyone can sign up for a user account on this server without the need to be invited. Applies to Email-based signups only.'}),
|
||||
isDisabled: it.not(it.userHasWritePermissionOnResource(RESOURCE_KEYS.AUTHENTICATION.SIGNUP)),
|
||||
},
|
||||
{
|
||||
|
||||
@@ -87,6 +87,7 @@ const Login = ({onCustomizeHeader}: LoginProps) => {
|
||||
EnableSignUpWithGoogle,
|
||||
EnableSignUpWithOpenId,
|
||||
EnableOpenServer,
|
||||
EnableUserCreation,
|
||||
LdapLoginFieldName,
|
||||
GitLabButtonText,
|
||||
GitLabButtonColor,
|
||||
@@ -125,10 +126,11 @@ const Login = ({onCustomizeHeader}: LoginProps) => {
|
||||
const enableCustomBrand = EnableCustomBrand === 'true';
|
||||
const enableLdap = EnableLdap === 'true';
|
||||
const enableOpenServer = EnableOpenServer === 'true';
|
||||
const enableUserCreation = EnableUserCreation === 'true';
|
||||
const enableSaml = EnableSaml === 'true';
|
||||
const enableSignInWithEmail = EnableSignInWithEmail === 'true';
|
||||
const enableSignInWithUsername = EnableSignInWithUsername === 'true';
|
||||
const enableSignUpWithEmail = EnableSignUpWithEmail === 'true';
|
||||
const enableSignUpWithEmail = enableUserCreation && EnableSignUpWithEmail === 'true';
|
||||
const enableSignUpWithGitLab = EnableSignUpWithGitLab === 'true';
|
||||
const enableSignUpWithGoogle = EnableSignUpWithGoogle === 'true';
|
||||
const enableSignUpWithOffice365 = EnableSignUpWithOffice365 === 'true';
|
||||
|
||||
@@ -1,5 +1,82 @@
|
||||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`components/signup/Signup should match snapshot for all signup options enabled with EnableUserCreaton disabled 1`] = `
|
||||
<div
|
||||
className="signup-body"
|
||||
>
|
||||
<div
|
||||
className="signup-body-content"
|
||||
>
|
||||
<div
|
||||
className="signup-body-message with-alternate-link"
|
||||
>
|
||||
<h1
|
||||
className="signup-body-message-title"
|
||||
>
|
||||
Let’s get started
|
||||
</h1>
|
||||
<p
|
||||
className="signup-body-message-subtitle"
|
||||
>
|
||||
Create your Mattermost account to start collaborating with your team
|
||||
</p>
|
||||
<div
|
||||
className="signup-body-message-svg"
|
||||
>
|
||||
<Svg />
|
||||
</div>
|
||||
</div>
|
||||
<div
|
||||
className="signup-body-action"
|
||||
>
|
||||
<AlternateLink
|
||||
alternateLinkLabel="Log in"
|
||||
alternateLinkPath="/login"
|
||||
alternateMessage="Already have an account?"
|
||||
className="signup-body-alternate-link"
|
||||
/>
|
||||
<div
|
||||
className="signup-body-card"
|
||||
>
|
||||
<div
|
||||
className="signup-body-card-content"
|
||||
onKeyDown={[Function]}
|
||||
tabIndex={0}
|
||||
>
|
||||
<p
|
||||
className="signup-body-card-title"
|
||||
>
|
||||
Create your account with one of the following:
|
||||
</p>
|
||||
<div
|
||||
className="signup-body-card-form-login-options column"
|
||||
>
|
||||
<ExternalLoginButton
|
||||
direction="column"
|
||||
icon={<LockIcon />}
|
||||
id="ldap"
|
||||
key="ldap"
|
||||
label="AD/LDAP Credentials"
|
||||
onClick={[Function]}
|
||||
url="/login?extra=create_ldap"
|
||||
/>
|
||||
<ExternalLoginButton
|
||||
direction="column"
|
||||
icon={<LockIcon />}
|
||||
id="saml"
|
||||
key="saml"
|
||||
label="SAML"
|
||||
onClick={[Function]}
|
||||
url="/login/sso/saml?action=signup"
|
||||
/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
|
||||
exports[`components/signup/Signup should match snapshot for all signup options enabled with isLicensed disabled 1`] = `
|
||||
<div
|
||||
className="signup-body"
|
||||
|
||||
@@ -157,6 +157,7 @@ describe('components/signup/Signup', () => {
|
||||
EnableSignUpWithGoogle: 'true',
|
||||
EnableSignUpWithOpenId: 'true',
|
||||
EnableOpenServer: 'true',
|
||||
EnableUserCreation: 'true',
|
||||
LdapLoginFieldName: '',
|
||||
GitLabButtonText: '',
|
||||
GitLabButtonColor: '',
|
||||
@@ -189,6 +190,16 @@ describe('components/signup/Signup', () => {
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should match snapshot for all signup options enabled with EnableUserCreaton disabled', () => {
|
||||
mockConfig.EnableUserCreation = 'false';
|
||||
|
||||
const wrapper = shallow(
|
||||
<Signup/>,
|
||||
);
|
||||
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it('should create user, log in and redirect to invite teamname', async () => {
|
||||
mockLocation.search = 'd=%7B"name"%3A"teamName"%7D';
|
||||
|
||||
|
||||
@@ -85,6 +85,7 @@ const Signup = ({onCustomizeHeader}: SignupProps) => {
|
||||
const config = useSelector(getConfig);
|
||||
const {
|
||||
EnableOpenServer,
|
||||
EnableUserCreation,
|
||||
NoAccounts,
|
||||
EnableSignUpWithEmail,
|
||||
EnableSignUpWithGitLab,
|
||||
@@ -117,17 +118,18 @@ const Signup = ({onCustomizeHeader}: SignupProps) => {
|
||||
|
||||
const isLicensed = IsLicensed === 'true';
|
||||
const enableOpenServer = EnableOpenServer === 'true';
|
||||
const enableUserCreation = EnableUserCreation === 'true';
|
||||
const noAccounts = NoAccounts === 'true';
|
||||
const enableSignUpWithEmail = EnableSignUpWithEmail === 'true';
|
||||
const enableSignUpWithGitLab = EnableSignUpWithGitLab === 'true';
|
||||
const enableSignUpWithGoogle = EnableSignUpWithGoogle === 'true';
|
||||
const enableSignUpWithOffice365 = EnableSignUpWithOffice365 === 'true';
|
||||
const enableSignUpWithOpenId = EnableSignUpWithOpenId === 'true';
|
||||
const enableSignUpWithEmail = enableUserCreation && EnableSignUpWithEmail === 'true';
|
||||
const enableSignUpWithGitLab = enableUserCreation && EnableSignUpWithGitLab === 'true';
|
||||
const enableSignUpWithGoogle = enableUserCreation && EnableSignUpWithGoogle === 'true';
|
||||
const enableSignUpWithOffice365 = enableUserCreation && EnableSignUpWithOffice365 === 'true';
|
||||
const enableSignUpWithOpenId = enableUserCreation && EnableSignUpWithOpenId === 'true';
|
||||
const enableLDAP = EnableLdap === 'true';
|
||||
const enableSAML = EnableSaml === 'true';
|
||||
const enableCustomBrand = EnableCustomBrand === 'true';
|
||||
|
||||
const noOpenServer = !inviteId && !token && !enableOpenServer && !noAccounts;
|
||||
const noOpenServer = !inviteId && !token && !enableOpenServer && !noAccounts && !enableUserCreation;
|
||||
|
||||
const [email, setEmail] = useState(parsedEmail ?? '');
|
||||
const [name, setName] = useState('');
|
||||
|
||||
@@ -2655,7 +2655,7 @@
|
||||
"admin.team.maxUsersExample": "E.g.: \"25\"",
|
||||
"admin.team.maxUsersTitle": "Max Users Per Team:",
|
||||
"admin.team.noBrandImage": "No brand image uploaded",
|
||||
"admin.team.openServerDescription": "When true, anyone can signup for a user account on this server without the need to be invited.",
|
||||
"admin.team.openServerDescription": "When true, anyone can sign up for a user account on this server without the need to be invited. Applies to Email-based signups only.",
|
||||
"admin.team.openServerTitle": "Enable Open Server: ",
|
||||
"admin.team.refreshPostStatsRunTimeDescription": "Set the server time for updating the user post statistics, including each user's total post count and the timestamp of their most recent post. Must be a 24-hour time stamp in the form HH:MM based on the local time of the server.",
|
||||
"admin.team.refreshPostStatsRunTimeExample": "E.g.: \"00:00\"",
|
||||
@@ -2678,7 +2678,7 @@
|
||||
"admin.team.teammateNameDisplay": "Teammate Name Display:",
|
||||
"admin.team.teammateNameDisplayDesc": "Set how to display users' names in posts and the Direct Messages list.",
|
||||
"admin.team.uploadDesc": "Customize your user experience by adding a custom image to your login screen. Recommended maximum image size is less than 2 MB.",
|
||||
"admin.team.userCreationDescription": "When false, the ability to create accounts is disabled. The create account button displays error when pressed.",
|
||||
"admin.team.userCreationDescription": "When false, the ability to create accounts is disabled, and selecting Create Account displays an error. Applies to Email, OpenID Connect, and OAuth 2.0 user account authentication.",
|
||||
"admin.team.userCreationTitle": "Enable Account Creation: ",
|
||||
"admin.trial_banner.trial-request.error": "Trial license could not be retrieved. Visit <link>{trialInfoLink}</link> to request a license.",
|
||||
"admin.true": "True",
|
||||
|
||||
Ссылка в новой задаче
Block a user