Radarr/frontend/src/Components/Form/PasswordInput.js
Mark McDowall a9a0d47f9f Fixed: Copying passwords
(cherry picked from commit c871b3f9487b9bfeb3726d763a632a772b420a0a)
2020-10-11 20:36:46 -04:00

29 lines
581 B
JavaScript

import PropTypes from 'prop-types';
import React from 'react';
import TextInput from './TextInput';
import styles from './PasswordInput.css';
// Prevent a user from copying (or cutting) the password from the input
function onCopy(e) {
e.preventDefault();
e.nativeEvent.stopImmediatePropagation();
}
function PasswordInput(props) {
return (
<TextInput
{...props}
onCopy={onCopy}
/>
);
}
PasswordInput.propTypes = {
className: PropTypes.string.isRequired
};
PasswordInput.defaultProps = {
className: styles.input
};
export default PasswordInput;