Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

Dashboard page appears for a fraction of a second when not logged in


Hi,

Templates have a behavior of showing the dashboard page for a fraction of a second, even when the user is not logged in. When accessing the app made with the template, it shows the dashboard screen for a fraction of a second and then the user is redirected to the login page, causing a bad experience.

Is this behavior possible to change?

I don't want to show the inside of the system to a user who is not registered.

Thanks!
MB

PS. Using VUE in 8.1.5 Metronic version


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (3)


Hi Mateus,

Do you use the same redirect functionality as it is in the latest Metronic?

We redirect unauthenticated users to the sign-in page and dashboard page shouldn't appear.

Check router/index.ts.

if (to.meta.middleware == "auth") {
if (store.getters.isUserAuthenticated) {
next();
} else {
next({ name: "sign-in" });
}
} else {
next();
}


Regards,
Lauris Stepanovs,
Keenthemes Support Team



Hi Lauris,

Implement the code, but even so the behavior remains the same, ie it didn't work.

Any other idea?

BR,
MB



This code shouldn't allow the unauthenticated user to see the dashboard page.

Were you able to reproduce this issue on our preview page?
https://preview.keenthemes.com/metronic8/vue/demo1/#/dashboard

As an alternative solution, you can use v-if directive in src/layouts/main-layout/MainLayout.vue.

Add new computed property:

const isUserAuthenticated = computed(() => {
return store.getters.isAuthenticated();
});


Then you can use it on the root element to hide the layout for unauthenticated users.

<div
v-if="isUserAuthenticated"
class="d-flex flex-column flex-root app-root"

>

</div>


Regards,
Lauris Stepanovs,
Keenthemes Support Team


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(