react-ux-password-field icon indicating copy to clipboard operation
react-ux-password-field copied to clipboard

mutating toggleMask prop throws JS errors

Open mmw opened this issue 9 years ago • 0 comments

If toggleMask is set to false I cannot then set it to true. It throws an error that this.maskPassword is not defined.

Relevant line causing the issue: https://github.com/seethroughtrees/react-ux-password-field/blob/master/src/index.js#L212-L214

Solution: this.maskPassword should always be defined

Reason for wanting to mutate toggleMask: if a user has "remember password" browser feature enabled the full password will flash when they navigate to a "settings" type page. For our project we'd prefer to not have this initial flash and instead only show the characters once we have real user input.

Alternatively this could be fixed by listening to key up/down events instead of change. I think the former solution is better. I'd be more than happy to submit a PR for this. Thoughts on approach?

mmw avatar Feb 24 '16 15:02 mmw