Remove password reveal feature from IE and Edge using ::-ms-reveal pseudo selector

This commit is contained in:
Rick Watson 2019-04-21 13:37:25 +01:00
parent 49bf6fc2e1
commit 5f529ecf51

View File

@ -1,11 +1,21 @@
import React from 'react'; import React from 'react';
import { TextValidator } from 'react-material-ui-form-validator'; import { TextValidator } from 'react-material-ui-form-validator';
import { withStyles } from '@material-ui/core/styles';
import { InputAdornment } from '@material-ui/core'; import { InputAdornment } from '@material-ui/core';
import Visibility from '@material-ui/icons/Visibility'; import Visibility from '@material-ui/icons/Visibility';
import VisibilityOff from '@material-ui/icons/VisibilityOff'; import VisibilityOff from '@material-ui/icons/VisibilityOff';
import IconButton from '@material-ui/core/IconButton'; import IconButton from '@material-ui/core/IconButton';
export default class PasswordValidator extends React.Component { const styles = theme => (
{
input: {
"&::-ms-reveal": {
display: "none"
}
}
});
class PasswordValidator extends React.Component {
state = { state = {
showPassword: false showPassword: false
@ -18,11 +28,13 @@ export default class PasswordValidator extends React.Component {
} }
render() { render() {
const { classes, ...rest } = this.props;
return ( return (
<TextValidator <TextValidator
{...this.props} {...rest}
type={this.state.showPassword ? 'text' : 'password'} type={this.state.showPassword ? 'text' : 'password'}
InputProps={{ InputProps={{
classes,
endAdornment: endAdornment:
<InputAdornment position="end"> <InputAdornment position="end">
<IconButton <IconButton
@ -38,3 +50,5 @@ export default class PasswordValidator extends React.Component {
} }
} }
export default withStyles(styles)(PasswordValidator);