[MM-54841] Convert LocalizedInput of 'oauth_to_email.tsx' to regular input component (#24852)

Этот коммит содержится в:
Manuel Hidalgo Lorente
2023-10-10 15:06:34 +02:00
коммит произвёл GitHub
родитель 52072ccf31
Коммит 4ae44810d3

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

@@ -3,16 +3,13 @@
import classNames from 'classnames'; import classNames from 'classnames';
import React, {useRef, useState} from 'react'; import React, {useRef, useState} 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 {oauthToEmail} from 'actions/admin_actions.jsx'; import {oauthToEmail} from 'actions/admin_actions.jsx';
import LocalizedInput from 'components/localized_input/localized_input';
import Constants from 'utils/constants'; import Constants from 'utils/constants';
import {t} from 'utils/i18n';
import {isValidPassword, localizeMessage, toTitleCase} from 'utils/utils'; import {isValidPassword, localizeMessage, toTitleCase} from 'utils/utils';
import type {getPasswordConfig} from 'utils/utils'; import type {getPasswordConfig} from 'utils/utils';
@@ -26,6 +23,7 @@ type Props = {
} }
const OAuthToEmail = (props: Props) => { const OAuthToEmail = (props: Props) => {
const intl = useIntl();
const passwordInput = useRef<HTMLInputElement>(null); const passwordInput = useRef<HTMLInputElement>(null);
const passwordConfirmInput = useRef<HTMLInputElement>(null); const passwordConfirmInput = useRef<HTMLInputElement>(null);
@@ -72,8 +70,6 @@ const OAuthToEmail = (props: Props) => {
}; };
const uiType = `${(props.currentType === Constants.SAML_SERVICE ? Constants.SAML_SERVICE.toUpperCase() : toTitleCase(props.currentType || ''))} SSO`; const uiType = `${(props.currentType === Constants.SAML_SERVICE ? Constants.SAML_SERVICE.toUpperCase() : toTitleCase(props.currentType || ''))} SSO`;
const placeholderPasswordMessage = {id: t('claim.oauth_to_email.newPwd'), defaultMessage: 'New Password'};
const placeholderConfirmMessage = {id: t('claim.oauth_to_email.confirm'), defaultMessage: 'Confirm Password'};
return ( return (
<> <>
@@ -99,22 +95,28 @@ const OAuthToEmail = (props: Props) => {
/> />
</p> </p>
<div className={classNames('form-group', {'has-error': error})}> <div className={classNames('form-group', {'has-error': error})}>
<LocalizedInput <input
type='password' type='password'
className='form-control' className='form-control'
name='password' name='password'
ref={passwordInput} ref={passwordInput}
placeholder={placeholderPasswordMessage} placeholder={intl.formatMessage({
id: 'claim.oauth_to_email.newPwd',
defaultMessage: 'New Password',
})}
spellCheck='false' spellCheck='false'
/> />
</div> </div>
<div className={classNames('form-group', {'has-error': error})}> <div className={classNames('form-group', {'has-error': error})}>
<LocalizedInput <input
type='password' type='password'
className='form-control' className='form-control'
name='passwordconfirm' name='passwordconfirm'
ref={passwordConfirmInput} ref={passwordConfirmInput}
placeholder={placeholderConfirmMessage} placeholder={intl.formatMessage({
id: 'claim.oauth_to_email.confirm',
defaultMessage: 'Confirm Password',
})}
spellCheck='false' spellCheck='false'
/> />
</div> </div>