Hello I'm implementing the OTP functionality modal that can be opened few times, once when you navigating to the app and second on some specific action for example clicking on some action button.
I'm using Vue2 and Buefy if that matters, so the problem is that once I submit the code and open modal again it has previously added code filled in already. I have tried to specify autocomplete as one-time-code or new-password none of them work.
Here is my implementation
Input component
<b-input
:name="name"
:value="value"
:placeholder="placeholder"
:disabled="disabled"
:maxlength="maxLength"
:type="type"
:autocomplete="autocomplete"
:inputmode="inputmode"
@input="(value) => $emit('input', value)"
>
</b-input>
JS part
export default {
name: "Input",
props: {
name: String,
label: String,
placeholder: String,
value: String,
autocomplete: String,
inputmode: {
type: String,
default: "text"
},
type: {
type: String,
default: "text"
},
disabled: {
type: Boolean,
default: false
},
maxLength: Number
}
};
OTP modal
<b-modal :active="isOpen" width="200" :can-cancel="canCancel">
<div>
<h2>Otp modal</h2>
<Input
label="Otp code"
name="otp"
v-model="code"
placeholder="code"
type="password"
:maxLength="4"
autocomplete="one-time-code"
inputMode="numeric"
/>
<slot></slot>
<b-button type="is-primary" @click="close">Submit</b-button>
<b-button type="is-primary is-light" @click="close">Close</b-button>
</div>
</b-modal>
CodeSandbox for clickable demo: https://codesandbox.io/s/buefy-otp-test-onuh1