invalid credentials error on login.vue
This commit is contained in:
parent
d06fb395b9
commit
7391f6f85d
2 changed files with 20 additions and 4 deletions
|
|
@ -27,7 +27,7 @@ interface TextMessage {
|
||||||
content: string;
|
content: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
const ip = 'ws://127.0. 0.1';
|
const ip = 'ws://127.0.0.1';
|
||||||
const port = 8760;
|
const port = 8760;
|
||||||
const reconnectTimeout = 3000; //ms
|
const reconnectTimeout = 3000; //ms
|
||||||
let socket: WebSocket;
|
let socket: WebSocket;
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
<template>
|
<template>
|
||||||
<form id="login" @submit.prevent="submit">
|
<form id="login" @submit.prevent="submit">
|
||||||
|
|
||||||
|
|
||||||
<!-- login title -->
|
<!-- login title -->
|
||||||
<div id="loginTitle">
|
<div id="loginTitle">
|
||||||
<div>Login</div>
|
<div>Login</div>
|
||||||
|
|
@ -25,6 +26,9 @@
|
||||||
<!-- submit button; position: fixed -->
|
<!-- submit button; position: fixed -->
|
||||||
<button class="submitButton button" type="submit">Submit</button>
|
<button class="submitButton button" type="submit">Submit</button>
|
||||||
|
|
||||||
|
<div class="invalid" v-if="invalid">
|
||||||
|
Incorrect Credentials
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<!-- back to login button: position: fixed -->
|
<!-- back to login button: position: fixed -->
|
||||||
|
|
@ -52,6 +56,7 @@ export default defineComponent({
|
||||||
const email = ref("");
|
const email = ref("");
|
||||||
const password = ref("");
|
const password = ref("");
|
||||||
const rememberMe = ref(true);
|
const rememberMe = ref(true);
|
||||||
|
const invalid = ref(false);
|
||||||
|
|
||||||
const { invoke } = useIpc();
|
const { invoke } = useIpc();
|
||||||
|
|
||||||
|
|
@ -64,9 +69,11 @@ export default defineComponent({
|
||||||
try {
|
try {
|
||||||
const res = await invoke('auth-session', payload);
|
const res = await invoke('auth-session', payload);
|
||||||
setToken(res);
|
setToken(res);
|
||||||
|
invalid.value = false;
|
||||||
router.push({ name: "home" });
|
router.push({ name: "home" });
|
||||||
} catch(e){
|
} catch(e){
|
||||||
console.log('Error loging in.')
|
invalid.value = true;
|
||||||
|
console.log('Error loging in.');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
@ -79,7 +86,8 @@ export default defineComponent({
|
||||||
email,
|
email,
|
||||||
password,
|
password,
|
||||||
rememberMe,
|
rememberMe,
|
||||||
switchView
|
switchView,
|
||||||
|
invalid
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
|
|
@ -110,7 +118,7 @@ export default defineComponent({
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
align-items: center;
|
align-items: center;
|
||||||
justify-content: center;
|
justify-content: center;
|
||||||
padding-bottom: 30px;
|
padding-bottom: 20px;
|
||||||
}
|
}
|
||||||
|
|
||||||
.inputBox {
|
.inputBox {
|
||||||
|
|
@ -177,4 +185,12 @@ export default defineComponent({
|
||||||
cursor: pointer;
|
cursor: pointer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.invalid {
|
||||||
|
margin-bottom: 30px;
|
||||||
|
font-family: "SF Compact Display";
|
||||||
|
font-weight: bold;
|
||||||
|
font-size: 14px;
|
||||||
|
color: #F53737;
|
||||||
|
}
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue