change the boolean variable isAdminPwdField to hasComplexityRequirements

This commit is contained in:
dorj222 2023-02-21 16:10:38 +01:00
parent 1d535ea9b5
commit 63e25fae3f
3 changed files with 12 additions and 12 deletions

View file

@ -32,7 +32,7 @@ export type TextFieldProps = {
useTrim?: boolean;
useTrimLead?: boolean;
value?: string | number;
isAdminPwdField?: boolean;
hasComplexityRequirements?: boolean;
onBlur?: FieldUpdaterFunc;
onChange?: FieldUpdaterFunc;
};
@ -55,7 +55,7 @@ export const TextField: FC<TextFieldProps> = ({
type,
useTrim,
value,
isAdminPwdField,
hasComplexityRequirements,
}) => {
const [hasPwdChanged, setHasPwdChanged] = useState(false);
const [showPwdButton, setShowPwdButton] = useState(false);
@ -65,7 +65,7 @@ export const TextField: FC<TextFieldProps> = ({
if (onChange) {
const val = type === TEXTFIELD_TYPE_NUMBER ? e : e.target.value;
setShowPwdButton(true);
if (isAdminPwdField && REGEX_PASSWORD.test(val)) {
if (hasComplexityRequirements && REGEX_PASSWORD.test(val)) {
setHasPwdChanged(true);
} else {
setHasPwdChanged(false);
@ -150,7 +150,7 @@ export const TextField: FC<TextFieldProps> = ({
</div>
) : null}
{!isAdminPwdField ? (
{!hasComplexityRequirements ? (
<div className="input-side">
<div className="input-group">
<Field
@ -231,7 +231,7 @@ TextField.defaultProps = {
pattern: '',
useTrim: false,
useTrimLead: false,
isAdminPwdField: false,
hasComplexityRequirements: false,
onSubmit: () => {},
onBlur: () => {},

View file

@ -24,7 +24,7 @@ export type TextFieldWithSubmitProps = TextFieldProps & {
apiPath: string;
configPath?: string;
initialValue?: string;
isAdminPwdField?: boolean;
hasComplexityRequirements?: boolean;
};
export const TextFieldWithSubmit: FC<TextFieldWithSubmitProps> = ({
@ -44,7 +44,7 @@ export const TextFieldWithSubmit: FC<TextFieldWithSubmitProps> = ({
let resetTimer = null;
const { fieldName, required, tip, status, value, isAdminPwdField, onChange, onSubmit } =
const { fieldName, required, tip, status, value, hasComplexityRequirements, onChange, onSubmit } =
textFieldProps;
// Clear out any validation states and messaging
@ -138,7 +138,7 @@ export const TextFieldWithSubmit: FC<TextFieldWithSubmitProps> = ({
<div className="field-tip">{tip}</div>
<FormStatusIndicator status={status || submitStatus} />
<div className="update-button-container">
{!isAdminPwdField && (
{!hasComplexityRequirements && (
<Button
type="primary"
size="small"

View file

@ -122,7 +122,7 @@ export const TEXTFIELD_PROPS_ADMIN_PASSWORD = {
label: 'Admin Password',
tip: 'Save this password somewhere safe, you will need it to login to the admin dashboard!',
required: true,
isAdminPwdField: true,
hasComplexityRequirements: true,
};
export const TEXTFIELD_PROPS_FFMPEG = {
apiPath: API_FFMPEG,
@ -132,7 +132,7 @@ export const TEXTFIELD_PROPS_FFMPEG = {
label: 'FFmpeg Path',
tip: 'Absolute file path of the FFMPEG application on your server',
required: true,
isAdminPwdField: false,
hasComplexityRequirements: false,
};
export const TEXTFIELD_PROPS_WEB_PORT = {
apiPath: API_WEB_PORT,
@ -142,7 +142,7 @@ export const TEXTFIELD_PROPS_WEB_PORT = {
label: 'Owncast port',
tip: 'What port is your Owncast web server listening? Default is 8080',
required: true,
isAdminPwdField: false,
hasComplexityRequirements: false,
};
export const TEXTFIELD_PROPS_RTMP_PORT = {
apiPath: API_RTMP_PORT,
@ -152,7 +152,7 @@ export const TEXTFIELD_PROPS_RTMP_PORT = {
label: 'RTMP port',
tip: 'What port should accept inbound broadcasts? Default is 1935',
required: true,
isAdminPwdField: false,
hasComplexityRequirements: false,
};
export const TEXTFIELD_PROPS_INSTANCE_URL = {
apiPath: API_INSTANCE_URL,