0

I would like to know if you can block the option to paste in a component, ui: inputSecret

    <ui:inputSecret value="" aura:id="input1" class="field row-of-icons" maxlength="8" keyup="{!c.onKeyUp}"
    updateOn="keyup" label="Contraseña" />

I can not copy in the components but I can paste from other sides

1

1 Answer 1

2

ui:inputSecret is deprecated and will stop working in the near future. Use <input type="password">. In the interim, if you really want to do this, put a wrapper around the element and catch onpaste from there:

<div onpaste="{!c.block}">
    <ui:inputSecret label="Demo" />
</div>

block: function(component, event, helper) {
    event.preventDefault();
}

Unless you have a very good reason (and many would argue there is no good reason), you should not block pasting passwords. This encourages using weak passwords and may actually help compromise security controls.

1
  • Thank you very much, I will take that recommendation into account Apr 17, 2021 at 3:19

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .