routes.ts 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. // Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. import type { RouteRecordRaw } from 'vue-router'
  3. export const isMainRoute = true
  4. const route: RouteRecordRaw[] = [
  5. {
  6. path: '/login',
  7. name: 'Login',
  8. component: () => import('./views/Login.vue'),
  9. meta: {
  10. title: __('Sign in'),
  11. requiresAuth: false,
  12. requiredPermission: null,
  13. redirectToDefaultRoute: true,
  14. hasOwnLandmarks: true,
  15. sidebar: false,
  16. },
  17. },
  18. {
  19. path: '/admin-password-auth',
  20. name: 'AdminPasswordAuth',
  21. component: () => import('./views/AdminPasswordAuth.vue'),
  22. meta: {
  23. title: __('Admin Password Login'),
  24. requiresAuth: false,
  25. requiredPermission: null,
  26. redirectToDefaultRoute: true,
  27. hasOwnLandmarks: true,
  28. sidebar: false,
  29. },
  30. },
  31. {
  32. path: '/login/after-auth',
  33. name: 'LoginAfterAuth',
  34. component: () => import('./views/LoginAfterAuth.vue'),
  35. meta: {
  36. requiresAuth: true,
  37. requiredPermission: null,
  38. hasOwnLandmarks: true,
  39. sidebar: false,
  40. },
  41. },
  42. {
  43. path: '/reset-password',
  44. name: 'PasswordReset',
  45. component: () => import('./views/PasswordReset.vue'),
  46. meta: {
  47. requiresAuth: false,
  48. requiredPermission: null,
  49. redirectToDefaultRoute: true,
  50. hasOwnLandmarks: true,
  51. sidebar: false,
  52. },
  53. },
  54. {
  55. path: '/reset-password/verify/:token?',
  56. name: 'PasswordResetVerify',
  57. props: true,
  58. component: () => import('./views/PasswordResetVerify.vue'),
  59. meta: {
  60. requiresAuth: false,
  61. requiredPermission: null,
  62. redirectToDefaultRoute: true,
  63. hasOwnLandmarks: true,
  64. sidebar: false,
  65. },
  66. },
  67. {
  68. path: '/logout',
  69. name: 'Logout',
  70. component: {
  71. async beforeRouteEnter() {
  72. const [{ useAuthenticationStore }, { useNotifications }] =
  73. await Promise.all([
  74. import('#shared/stores/authentication.ts'),
  75. import(
  76. '#shared/components/CommonNotifications/useNotifications.ts'
  77. ),
  78. ])
  79. const { clearAllNotifications } = useNotifications()
  80. const authentication = useAuthenticationStore()
  81. clearAllNotifications()
  82. await authentication.logout()
  83. if (authentication.externalLogout) return false
  84. return '/login'
  85. },
  86. },
  87. meta: {
  88. requiresAuth: false,
  89. requiredPermission: null,
  90. },
  91. },
  92. {
  93. path: '/signup',
  94. name: 'Signup',
  95. component: () => import('./views/Signup.vue'),
  96. meta: {
  97. title: __('Sign up'),
  98. requiresAuth: false,
  99. requiredPermission: null,
  100. redirectToDefaultRoute: true,
  101. hasOwnLandmarks: true,
  102. sidebar: false,
  103. },
  104. },
  105. {
  106. path: '/signup/verify/:token?',
  107. name: 'SignupVerify',
  108. props: true,
  109. component: () => import('./views/SignupVerify.vue'),
  110. meta: {
  111. title: __('Email Verification'),
  112. requiresAuth: false,
  113. requiredPermission: null,
  114. redirectToDefaultRoute: true,
  115. hasOwnLandmarks: true,
  116. sidebar: false,
  117. },
  118. },
  119. ]
  120. export default route