Bladeren bron

refactor(RemoveAccount): added code to allow submit password on enter and autofill

Kristian Vos 3 jaren geleden
bovenliggende
commit
05fb71fdba
1 gewijzigde bestanden met toevoegingen van 22 en 0 verwijderingen
  1. 22 0
      frontend/src/components/modals/RemoveAccount.vue

+ 22 - 0
frontend/src/components/modals/RemoveAccount.vue

@@ -73,6 +73,15 @@
 								autofocus
 								ref="password"
 								v-model="password.value"
+								@input="
+									checkForAutofill(
+										confirmPasswordMatch,
+										$event
+									)
+								"
+								@keypress="
+									submitOnEnter(confirmPasswordMatch, $event)
+								"
 							/>
 							<a @click="togglePasswordVisibility()">
 								<i class="material-icons">
@@ -201,6 +210,19 @@ export default {
 		this.accountRemovalMessage = await lofig.get("messages.accountRemoval");
 	},
 	methods: {
+		checkForAutofill(cb, event) {
+			if (
+				event.target.value !== "" &&
+				event.inputType === undefined &&
+				event.data === undefined &&
+				event.dataTransfer === undefined &&
+				event.isComposing === undefined
+			)
+				cb();
+		},
+		submitOnEnter(cb, event) {
+			if (event.which === 13) cb();
+		},
 		togglePasswordVisibility() {
 			if (this.$refs.password.type === "password") {
 				this.$refs.password.type = "text";