Merge branch 'master' into develop
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
import { useLayout } from '@/layout/composables/layout';
|
||||
import { useAuth } from '@websanova/vue-auth/src/v3.js';
|
||||
import { computed, ref } from 'vue';
|
||||
import { useRouter } from 'vue-router';
|
||||
//import logo from '@/assets/Logo_Apollo_Transparent.png';
|
||||
import logo from '@/assets/apollo.jpg';
|
||||
import { useRouter } from 'vue-router';
|
||||
@@ -10,6 +11,9 @@ const auth = useAuth();
|
||||
const { isDarkTheme } = useLayout();
|
||||
const username = ref('');
|
||||
const password = ref('');
|
||||
const error = ref('');
|
||||
const visible = ref(false);
|
||||
const router = useRouter();
|
||||
const logoSrc = ref(logo);
|
||||
const router = useRouter();
|
||||
|
||||
@@ -18,36 +22,29 @@ const logoUrl = computed(() => {
|
||||
});
|
||||
|
||||
const login = async () => {
|
||||
try {
|
||||
await auth.login({
|
||||
data: {
|
||||
"username": username.value,
|
||||
"password": password.value
|
||||
},
|
||||
fetchUser: true
|
||||
}).then((response) => {
|
||||
console.log("1 user :", response.data.data);
|
||||
|
||||
if (!response.data.data.selectedProject) {
|
||||
router.push({ name: 'projects-list' });
|
||||
} else {
|
||||
router.push({ path: '/ksdocuments' });
|
||||
}
|
||||
|
||||
console.log("response", response);
|
||||
}).catch((err) => {
|
||||
console.log("error", err);
|
||||
error.value = 'Incorrect username or password. Please try again.';
|
||||
visible.value = true;
|
||||
|
||||
setTimeout(() => {
|
||||
visible.value = false;
|
||||
}, 3500);
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Error ' + err);
|
||||
}
|
||||
try {
|
||||
await auth.login({
|
||||
data:{
|
||||
"username":username.value,
|
||||
"password":password.value
|
||||
},
|
||||
fetchUser: true
|
||||
}).then((response) => {
|
||||
console.log("1 user :" , response.data.data);
|
||||
router.push({ name: 'ksdocuments' });
|
||||
console.log("response", response);
|
||||
}).catch((err) => {
|
||||
console.log("error", err);
|
||||
error.value = 'Incorrect username or password. Please try again.';
|
||||
visible.value = true;
|
||||
|
||||
setTimeout(() => {
|
||||
visible.value = false;
|
||||
}, 3500);
|
||||
});
|
||||
} catch (err) {
|
||||
console.log('Error ' + err);
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -86,22 +83,22 @@ const login = async () => {
|
||||
<label for="password1" class="block text-surface-900 dark:text-surface-0 font-medium text-xl mb-2">Password</label>
|
||||
<Password id="password1" v-model="password" placeholder="Password" :toggleMask="true" class="w-full mb-4" inputClass="w-full" :inputStyle="{ padding: '1rem' }"></Password>
|
||||
|
||||
<!-- <div class="flex items-center justify-between mb-8 gap-8">
|
||||
<div class="flex items-center">
|
||||
<Checkbox v-model="checked" id="rememberme1" binary class="mr-2"></Checkbox>
|
||||
<label for="rememberme1">Remember me</label>
|
||||
</div>
|
||||
<a class="font-medium no-underline ml-2 text-right cursor-pointer" style="color: var(--primary-color)">Forgot password?</a>
|
||||
</div>
|
||||
-->
|
||||
<Button @click="login" label="Sign In" class="w-full p-4 text-xl"></Button>
|
||||
|
||||
<Message v-if="visible" severity="error" :life="3000" class="mt-2 error-message">{{ error }}</Message>
|
||||
|
||||
</div>
|
||||
<!--div class="flex items-center justify-between mb-8 gap-8">
|
||||
<div class="flex items-center">
|
||||
<Checkbox v-model="checked" id="rememberme1" binary class="mr-2"></Checkbox>
|
||||
<label for="rememberme1">Remember me</label>
|
||||
</div>
|
||||
<a class="font-medium no-underline ml-2 text-right cursor-pointer"
|
||||
style="color: var(--primary-color)">Forgot password?</a>
|
||||
</div> -->
|
||||
<Button label="Sign In" @click="login" class="w-full p-4 text-xl"></Button>
|
||||
|
||||
<Message v-if="visible" severity="error" :life="3000" class="mt-2 error-message">{{ error }}</Message>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@@ -142,4 +139,12 @@ const login = async () => {
|
||||
/* Ensures the logo scales nicely within the circle */
|
||||
display: block;
|
||||
}
|
||||
|
||||
.error-message {
|
||||
display: flex;
|
||||
justify-content: center;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
width: 100%; /* Ensure the message takes the full width of its container */
|
||||
}
|
||||
</style>
|
||||
|
||||
Reference in New Issue
Block a user