login/register on enter

This commit is contained in:
Bnyro 2022-08-18 13:47:10 +02:00
parent aeac623746
commit 1092fc7677
2 changed files with 6 additions and 0 deletions

View File

@ -11,6 +11,7 @@
autocomplete="username" autocomplete="username"
:placeholder="$t('login.username')" :placeholder="$t('login.username')"
:aria-label="$t('login.username')" :aria-label="$t('login.username')"
v-on:keyup.enter="login"
/> />
</div> </div>
<div> <div>
@ -21,6 +22,7 @@
autocomplete="password" autocomplete="password"
:placeholder="$t('login.password')" :placeholder="$t('login.password')"
:aria-label="$t('login.password')" :aria-label="$t('login.password')"
v-on:keyup.enter="login"
/> />
</div> </div>
<div> <div>
@ -49,6 +51,7 @@ export default {
}, },
methods: { methods: {
login() { login() {
if (!this.username || !this.password) return;
this.fetchJson(this.authApiUrl() + "/login", null, { this.fetchJson(this.authApiUrl() + "/login", null, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({

View File

@ -11,6 +11,7 @@
autocomplete="username" autocomplete="username"
:placeholder="$t('login.username')" :placeholder="$t('login.username')"
:aria-label="$t('login.username')" :aria-label="$t('login.username')"
v-on:keyup.enter="register"
/> />
</div> </div>
<div> <div>
@ -21,6 +22,7 @@
autocomplete="password" autocomplete="password"
:placeholder="$t('login.password')" :placeholder="$t('login.password')"
:aria-label="$t('login.password')" :aria-label="$t('login.password')"
v-on:keyup.enter="register"
/> />
</div> </div>
<div> <div>
@ -49,6 +51,7 @@ export default {
}, },
methods: { methods: {
register() { register() {
if (!this.username || !this.password) return;
this.fetchJson(this.authApiUrl() + "/register", null, { this.fetchJson(this.authApiUrl() + "/register", null, {
method: "POST", method: "POST",
body: JSON.stringify({ body: JSON.stringify({