Skip to content

armgit / dashy

Public Imported from GitHub
0

πŸš€ A self-hostable personal dashboard built for you. Includes status-checking, widgets, themes, icon packs, a UI editor and tons more!

:children_crossing: Pressing enter submits login form (#483)

Alicia Sykesc4f1be2b766c
diff --git a/src/components/FormElements/Input.vue b/src/components/FormElements/Input.vue
index 42ec58af..c0b81b37 100644
--- a/src/components/FormElements/Input.vue
+++ b/src/components/FormElements/Input.vue
@@ -14,6 +14,7 @@
:name="name"
:id="name"
:placeholder="placeholder"
+ @keyup.enter="onEnter ? onEnter() : () => {}"
class="input-field"
/>
<p
@@ -35,6 +36,7 @@ export default {
name: String, // Required unique ID value, for accessibility
placeholder: String, // Optional placeholder value
description: String, // Optional info paragraph
+ onEnter: Function,
type: {
default: 'text', // Input type, e.g. text, password, number
type: String,
diff --git a/src/views/Login.vue b/src/views/Login.vue
index a26685ec..2dc73e78 100644
--- a/src/views/Login.vue
+++ b/src/views/Login.vue
@@ -21,15 +21,15 @@
<!-- Main login form -->
<form class="login-form" v-if="(!isUserAlreadyLoggedIn) && isAuthenticationEnabled">
<h2 class="login-title">{{ $t('login.title') }}</h2>
- <Input
+ <Input type="text"
v-model="username"
- type="text"
+ :onEnter="submitLogin"
:label="$t('login.username-label')"
class="login-field username"
/>
- <Input
+ <Input type="password"
v-model="password"
- type="password"
+ :onEnter="submitLogin"
:label="$t('login.password-label')"
class="login-field password"
/>
@@ -38,6 +38,7 @@
v-model="timeout"
:selectOnTab="true"
:options="dropDownMenu"
+ :map-keydown="(map) => ({ ...map, 13: () => this.submitLogin() })"
class="login-time-dropdown"
/>
<Button class="login-button" :click="submitLogin">