routes.ts 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122
  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. },
  16. },
  17. {
  18. path: '/admin-password-auth',
  19. name: 'AdminPasswordAuth',
  20. component: () => import('./views/AdminPasswordAuth.vue'),
  21. meta: {
  22. title: __('Admin Password Login'),
  23. requiresAuth: false,
  24. requiredPermission: null,
  25. redirectToDefaultRoute: true,
  26. hasOwnLandmarks: true,
  27. },
  28. },
  29. {
  30. path: '/login/after-auth',
  31. name: 'LoginAfterAuth',
  32. component: () => import('./views/LoginAfterAuth.vue'),
  33. meta: {
  34. requiresAuth: true,
  35. requiredPermission: null,
  36. hasOwnLandmarks: true,
  37. },
  38. },
  39. {
  40. path: '/reset-password',
  41. name: 'PasswordReset',
  42. component: () => import('./views/PasswordReset.vue'),
  43. meta: {
  44. requiresAuth: false,
  45. requiredPermission: null,
  46. redirectToDefaultRoute: true,
  47. hasOwnLandmarks: true,
  48. },
  49. },
  50. {
  51. path: '/reset-password/verify/:token?',
  52. name: 'PasswordResetVerify',
  53. props: true,
  54. component: () => import('./views/PasswordResetVerify.vue'),
  55. meta: {
  56. requiresAuth: false,
  57. requiredPermission: null,
  58. redirectToDefaultRoute: true,
  59. hasOwnLandmarks: true,
  60. },
  61. },
  62. {
  63. path: '/logout',
  64. name: 'Logout',
  65. component: {
  66. async beforeRouteEnter() {
  67. const [{ useAuthenticationStore }, { useNotifications }] =
  68. await Promise.all([
  69. import('#shared/stores/authentication.ts'),
  70. import(
  71. '#shared/components/CommonNotifications/useNotifications.ts'
  72. ),
  73. ])
  74. const { clearAllNotifications } = useNotifications()
  75. const authentication = useAuthenticationStore()
  76. clearAllNotifications()
  77. await authentication.logout()
  78. if (authentication.externalLogout) return false
  79. return '/login'
  80. },
  81. },
  82. meta: {
  83. requiresAuth: false,
  84. requiredPermission: null,
  85. },
  86. },
  87. {
  88. path: '/signup',
  89. name: 'Signup',
  90. component: () => import('./views/Signup.vue'),
  91. meta: {
  92. title: __('Sign up'),
  93. requiresAuth: false,
  94. requiredPermission: null,
  95. redirectToDefaultRoute: true,
  96. hasOwnLandmarks: true,
  97. },
  98. },
  99. {
  100. path: '/signup/verify/:token?',
  101. name: 'SignupVerify',
  102. props: true,
  103. component: () => import('./views/SignupVerify.vue'),
  104. meta: {
  105. title: __('Email Verification'),
  106. requiresAuth: false,
  107. requiredPermission: null,
  108. redirectToDefaultRoute: true,
  109. hasOwnLandmarks: true,
  110. },
  111. },
  112. ]
  113. export default route