add password option to input modal
This commit is contained in:
parent
67b554c68f
commit
ab03633431
|
@ -161,7 +161,7 @@ export default new class E2EE extends BuiltinModule {
|
|||
seed = Security.randomBytes();
|
||||
let newMaster = '';
|
||||
try {
|
||||
newMaster = await Modals.input('E2EE', 'Master Key:').promise;
|
||||
newMaster = await Modals.input('E2EE', 'Master Key:', true).promise;
|
||||
} catch (err) {
|
||||
Toasts.error('Failed to set master key!');
|
||||
}
|
||||
|
|
|
@ -13,7 +13,8 @@
|
|||
}
|
||||
|
||||
input[type="text"],
|
||||
input[type="number"] {
|
||||
input[type="number"],
|
||||
input[type="password"] {
|
||||
background: transparent;
|
||||
border: none;
|
||||
color: #b9bbbe;
|
||||
|
|
|
@ -12,7 +12,8 @@
|
|||
<Modal :class="['bd-modal-basic', {'bd-modal-out': modal.closing}]" :headerText="modal.title" @close="modal.close">
|
||||
<div slot="body" class="bd-modal-basic-body bd-inputModalBody bd-form-textinput">
|
||||
{{ modal.text }}
|
||||
<input ref="input" type="text" @keyup.stop="keyup"/><!-- TODO Option for masked input -->
|
||||
<input v-if="modal.password" ref="input" type="password" @keyup.stop="keyup" />
|
||||
<input v-else ref="input" type="text" @keyup.stop="keyup"/>
|
||||
</div>
|
||||
<div slot="footer" class="bd-modal-controls">
|
||||
<div class="bd-flex-grow"></div>
|
||||
|
@ -46,6 +47,7 @@
|
|||
}
|
||||
},
|
||||
mounted() {
|
||||
window.t = this;
|
||||
this.$refs.input.focus();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -177,12 +177,12 @@ export default class Modals {
|
|||
return new Modal(modal, ConfirmModal);
|
||||
}
|
||||
|
||||
static input(title, text) {
|
||||
return this.add(this.createInputModal(title, text));
|
||||
static input(title, text, password = false) {
|
||||
return this.add(this.createInputModal(title, text, password));
|
||||
}
|
||||
|
||||
static createInputModal(title, text) {
|
||||
const modal = { title, text };
|
||||
static createInputModal(title, text, password = false) {
|
||||
const modal = { title, text, password };
|
||||
modal.promise = new Promise((resolve, reject) => {
|
||||
modal.confirm = value => resolve(value);
|
||||
modal.beforeClose = () => reject();
|
||||
|
|
Loading…
Reference in New Issue