chore: show an error for now, do not replace
Signed-off-by: blam <ben@blam.sh>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
/*
|
||||
* Copyright 2024 The Backstage Authors
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
import { WidgetProps } from '@rjsf/utils';
|
||||
import InputLabel from '@material-ui/core/InputLabel';
|
||||
import Input from '@material-ui/core/Input';
|
||||
import React from 'react';
|
||||
import FormHelperText from '@material-ui/core/FormHelperText';
|
||||
import { MarkdownContent } from '@backstage/core-components';
|
||||
|
||||
export const PasswordWidget = (
|
||||
props: Pick<WidgetProps, 'onChange' | 'schema' | 'value'>,
|
||||
) => {
|
||||
const {
|
||||
value,
|
||||
onChange,
|
||||
schema: { title },
|
||||
} = props;
|
||||
|
||||
return (
|
||||
<>
|
||||
<InputLabel htmlFor={title}>{title}</InputLabel>
|
||||
<Input
|
||||
id={title}
|
||||
aria-describedby={title}
|
||||
onChange={e => {
|
||||
onChange(e.target.value);
|
||||
}}
|
||||
value={value}
|
||||
autoComplete="off"
|
||||
/>
|
||||
<FormHelperText error>
|
||||
<MarkdownContent
|
||||
content="This widget is insecure. Please use [`ui:field: Secret`](https://backstage.io/docs/features/software-templates/writing-templates/#using-secrets) instead of
|
||||
`ui:widget: password`"
|
||||
/>
|
||||
</FormHelperText>
|
||||
</>
|
||||
);
|
||||
};
|
||||
@@ -50,6 +50,7 @@ import { ReviewStepProps } from '@backstage/plugin-scaffolder-react';
|
||||
import { ErrorListTemplate } from './ErrorListTemplate';
|
||||
import { makeStyles } from '@material-ui/core/styles';
|
||||
import { SecretWidget } from '../SecretWidget';
|
||||
import { PasswordWidget } from '../PasswordWidget/PasswordWidget';
|
||||
|
||||
const useStyles = makeStyles(theme => ({
|
||||
backButton: {
|
||||
@@ -233,7 +234,7 @@ export const Stepper = (stepperProps: StepperProps) => {
|
||||
showErrorList="top"
|
||||
templates={{ ErrorListTemplate }}
|
||||
onChange={handleChange}
|
||||
widgets={{ password: SecretWidget }}
|
||||
widgets={{ password: PasswordWidget }}
|
||||
experimental_defaultFormStateBehavior={{
|
||||
allOf: 'populateDefaults',
|
||||
}}
|
||||
|
||||
Reference in New Issue
Block a user