Fix UI :- fix the Password field showing in SSO login (#7811)

* Fix the Password field showing in SSO login

* changes as per comments
This commit is contained in:
Ashish Gupta 2022-09-30 18:07:29 +05:30 committed by GitHub
parent 986ce4a8b8
commit c4d67f489e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -26,7 +26,7 @@ import { AxiosError } from 'axios';
import classNames from 'classnames'; import classNames from 'classnames';
import { isUndefined } from 'lodash'; import { isUndefined } from 'lodash';
import { EditorContentRef } from 'Models'; import { EditorContentRef } from 'Models';
import React, { useRef, useState } from 'react'; import React, { useMemo, useRef, useState } from 'react';
import { useAuthContext } from '../../authentication/auth-provider/AuthProvider'; import { useAuthContext } from '../../authentication/auth-provider/AuthProvider';
import { generateRandomPwd } from '../../axiosAPIs/auth-API'; import { generateRandomPwd } from '../../axiosAPIs/auth-API';
import { getBotsPagePath, getUsersPagePath } from '../../constants/constants'; import { getBotsPagePath, getUsersPagePath } from '../../constants/constants';
@ -36,6 +36,7 @@ import {
validEmailRegEx, validEmailRegEx,
} from '../../constants/regex.constants'; } from '../../constants/regex.constants';
import { PageLayoutType } from '../../enums/layout.enum'; import { PageLayoutType } from '../../enums/layout.enum';
import { AuthTypes } from '../../enums/signin.enum';
import { CreatePasswordGenerator } from '../../enums/user.enum'; import { CreatePasswordGenerator } from '../../enums/user.enum';
import { import {
CreatePasswordType, CreatePasswordType,
@ -109,6 +110,11 @@ const CreateUser = ({
{} as SSOClientConfig {} as SSOClientConfig
); );
const isAuthProviderBasic = useMemo(
() => authConfig?.provider === AuthTypes.BASIC,
[authConfig]
);
const slashedBreadcrumbList = [ const slashedBreadcrumbList = [
{ {
name: forceBot ? 'Bots' : 'Users', name: forceBot ? 'Bots' : 'Users',
@ -775,6 +781,8 @@ const CreateUser = ({
<RichTextEditor initialValue={description} ref={markdownRef} /> <RichTextEditor initialValue={description} ref={markdownRef} />
</Form.Item> </Form.Item>
{isAuthProviderBasic && (
<>
<Radio.Group <Radio.Group
name="passwordGenerator" name="passwordGenerator"
value={passwordGenerator} value={passwordGenerator}
@ -861,7 +869,9 @@ const CreateUser = ({
</div> </div>
<div className="w-8 h-7 flex-center"> <div className="w-8 h-7 flex-center">
<CopyToClipboardButton copyText={generatedPassword} /> <CopyToClipboardButton
copyText={generatedPassword}
/>
</div> </div>
</div> </div>
} }
@ -871,6 +881,8 @@ const CreateUser = ({
</Form.Item> </Form.Item>
</div> </div>
)} )}
</>
)}
{!forceBot && ( {!forceBot && (
<> <>