Skip to content

Commit

Permalink
🚸 Pressing enter submits login form (gchq#483)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lissy93 committed Feb 9, 2022
1 parent 33855dc commit c4f1be2
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 2 additions & 0 deletions src/components/FormElements/Input.vue
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
:name="name"
:id="name"
:placeholder="placeholder"
@keyup.enter="onEnter ? onEnter() : () => {}"
class="input-field"
/>
<p
Expand All @@ -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,
Expand Down
9 changes: 5 additions & 4 deletions src/views/Login.vue
Original file line number Diff line number Diff line change
Expand Up @@ -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"
/>
Expand All @@ -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">
Expand Down

0 comments on commit c4f1be2

Please sign in to comment.