[MM-54839] Convert LocalizedInput of 'email_to_ldap.tsx' to regular input component (#24837)

Этот коммит содержится в:
js029
2023-10-11 08:15:13 +02:00
коммит произвёл GitHub
родитель 8ae1cb2c37
Коммит 463945e8cc

Просмотреть файл

@@ -3,13 +3,12 @@
import classNames from 'classnames'; import classNames from 'classnames';
import React, {useRef} from 'react'; import React, {useRef} from 'react';
import {FormattedMessage} from 'react-intl'; import {FormattedMessage, useIntl} from 'react-intl';
import type {AuthChangeResponse} from '@mattermost/types/users'; import type {AuthChangeResponse} from '@mattermost/types/users';
import {emailToLdap} from 'actions/admin_actions.jsx'; import {emailToLdap} from 'actions/admin_actions.jsx';
import LocalizedInput from 'components/localized_input/localized_input';
import LoginMfa from 'components/login/login_mfa'; import LoginMfa from 'components/login/login_mfa';
import {ClaimErrors} from 'utils/constants'; import {ClaimErrors} from 'utils/constants';
@@ -33,6 +32,8 @@ export type SubmitOptions = {
} }
const EmailToLDAP = ({email, siteName, ldapLoginFieldName}: Props) => { const EmailToLDAP = ({email, siteName, ldapLoginFieldName}: Props) => {
const {formatMessage} = useIntl();
const emailPasswordInput = useRef<HTMLInputElement>(null); const emailPasswordInput = useRef<HTMLInputElement>(null);
const ldapIdInput = useRef<HTMLInputElement>(null); const ldapIdInput = useRef<HTMLInputElement>(null);
const ldapPasswordInput = useRef<HTMLInputElement>(null); const ldapPasswordInput = useRef<HTMLInputElement>(null);
@@ -127,8 +128,6 @@ const EmailToLDAP = ({email, siteName, ldapLoginFieldName}: Props) => {
const loginPlaceholder = ldapLoginFieldName || localizeMessage('claim.email_to_ldap.ldapId', 'AD/LDAP ID'); const loginPlaceholder = ldapLoginFieldName || localizeMessage('claim.email_to_ldap.ldapId', 'AD/LDAP ID');
const titleMessage = {id: t('claim.email_to_ldap.title'), defaultMessage: 'Switch Email/Password Account to AD/LDAP'}; const titleMessage = {id: t('claim.email_to_ldap.title'), defaultMessage: 'Switch Email/Password Account to AD/LDAP'};
const placeholderPasswordMessage = {id: t('claim.email_to_ldap.pwd'), defaultMessage: 'Password'};
const placeholderLdapMessage = {id: t('claim.email_to_ldap.ldapPwd'), defaultMessage: 'AD/LDAP Password'};
if (showMfa) { if (showMfa) {
return ( return (
@@ -177,13 +176,13 @@ const EmailToLDAP = ({email, siteName, ldapLoginFieldName}: Props) => {
name='fakeusernameremembered' name='fakeusernameremembered'
/> />
<div className={classNames('form-group', {'has-error': passwordError})}> <div className={classNames('form-group', {'has-error': passwordError})}>
<LocalizedInput <input
type='password' type='password'
className='form-control' className='form-control'
name='emailPassword' name='emailPassword'
ref={emailPasswordInput} ref={emailPasswordInput}
autoComplete='off' autoComplete='off'
placeholder={placeholderPasswordMessage} placeholder={formatMessage({id: 'claim.email_to_ldap.pwd', defaultMessage: 'Password'})}
spellCheck='false' spellCheck='false'
/> />
</div> </div>
@@ -207,13 +206,13 @@ const EmailToLDAP = ({email, siteName, ldapLoginFieldName}: Props) => {
</div> </div>
<ErrorLabel errorText={ldapError}/> <ErrorLabel errorText={ldapError}/>
<div className={classNames('form-group', {'has-error': ldapPasswordError})}> <div className={classNames('form-group', {'has-error': ldapPasswordError})}>
<LocalizedInput <input
type='password' type='password'
className='form-control' className='form-control'
name='ldapPassword' name='ldapPassword'
ref={ldapPasswordInput} ref={ldapPasswordInput}
autoComplete='off' autoComplete='off'
placeholder={placeholderLdapMessage} placeholder={formatMessage({id: t('claim.email_to_ldap.ldapPwd'), defaultMessage: 'AD/LDAP Password'})}
spellCheck='false' spellCheck='false'
/> />
</div> </div>