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