2020-02-18 08:57:00 +01:00
|
|
|
import { beforeRegisterGuard } from "@/router/guards/register-guard";
|
2022-07-12 10:55:28 +02:00
|
|
|
import { RouteLocationNormalized, RouteRecordRaw } from "vue-router";
|
2021-10-10 16:24:12 +02:00
|
|
|
import { i18n } from "@/utils/i18n";
|
2019-01-29 11:02:32 +01:00
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
const t = i18n.global.t;
|
|
|
|
|
2019-02-22 14:55:47 +01:00
|
|
|
export enum UserRouteName {
|
2020-02-18 08:57:00 +01:00
|
|
|
REGISTER = "Register",
|
|
|
|
REGISTER_PROFILE = "RegisterProfile",
|
|
|
|
RESEND_CONFIRMATION = "ResendConfirmation",
|
|
|
|
SEND_PASSWORD_RESET = "SendPasswordReset",
|
|
|
|
PASSWORD_RESET = "PasswordReset",
|
2020-06-18 15:23:05 +02:00
|
|
|
EMAIL_VALIDATE = "EMAIL_VALIDATE",
|
2020-02-18 08:57:00 +01:00
|
|
|
VALIDATE = "Validate",
|
|
|
|
LOGIN = "Login",
|
2023-02-15 19:31:23 +01:00
|
|
|
OAUTH_AUTORIZE = "OAUTH_AUTORIZE",
|
2023-02-21 14:50:09 +01:00
|
|
|
OAUTH_LOGIN_DEVICE = "OAUTH_LOGIN_DEVICE",
|
2019-02-22 14:55:47 +01:00
|
|
|
}
|
|
|
|
|
2022-07-12 10:55:28 +02:00
|
|
|
export const userRoutes: RouteRecordRaw[] = [
|
2019-02-22 11:24:41 +01:00
|
|
|
{
|
2020-02-18 08:57:00 +01:00
|
|
|
path: "/register/user",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.REGISTER,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/RegisterView.vue"),
|
2019-02-22 11:24:41 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiredAuth: false,
|
2022-07-12 10:55:28 +02:00
|
|
|
announcer: { message: (): string => t("Register") as string },
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
2019-04-01 11:49:54 +02:00
|
|
|
beforeEnter: beforeRegisterGuard,
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
{
|
2022-09-27 10:50:14 +02:00
|
|
|
path: "/register/profile/:email/:userAlreadyActivated?",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.REGISTER_PROFILE,
|
2022-08-26 16:08:58 +02:00
|
|
|
component: (): Promise<any> => import("@/views/Account/RegisterView.vue"),
|
2019-02-25 17:20:06 +01:00
|
|
|
// We can only pass string values through params, therefore
|
2022-07-12 10:55:28 +02:00
|
|
|
props: (route: RouteLocationNormalized): Record<string, unknown> => ({
|
2020-02-18 08:57:00 +01:00
|
|
|
email: route.params.email,
|
|
|
|
userAlreadyActivated: route.params.userAlreadyActivated === "true",
|
|
|
|
}),
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiredAuth: false,
|
2022-07-12 10:55:28 +02:00
|
|
|
announcer: { message: (): string => t("Register") as string },
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
{
|
2023-03-23 20:39:39 +01:00
|
|
|
path: "/resend-instructions/:email?",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.RESEND_CONFIRMATION,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> =>
|
|
|
|
import("@/views/User/ResendConfirmation.vue"),
|
2019-02-22 11:24:41 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiresAuth: false,
|
|
|
|
announcer: {
|
2022-07-12 10:55:28 +02:00
|
|
|
message: (): string => t("Resent confirmation email") as string,
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
{
|
2023-03-23 20:39:39 +01:00
|
|
|
path: "/password-reset/send/:email?",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.SEND_PASSWORD_RESET,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/SendPasswordReset.vue"),
|
2019-02-22 11:24:41 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiresAuth: false,
|
|
|
|
announcer: {
|
2022-07-12 10:55:28 +02:00
|
|
|
message: (): string => t("Send password reset") as string,
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
{
|
2020-02-18 08:57:00 +01:00
|
|
|
path: "/password-reset/:token",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.PASSWORD_RESET,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/PasswordReset.vue"),
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiresAuth: false,
|
2022-07-12 10:55:28 +02:00
|
|
|
announcer: { message: (): string => t("Password reset") as string },
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
props: true,
|
|
|
|
},
|
2020-02-13 15:48:12 +01:00
|
|
|
{
|
2020-02-18 08:57:00 +01:00
|
|
|
path: "/validate/email/:token",
|
2020-06-18 15:23:05 +02:00
|
|
|
name: UserRouteName.EMAIL_VALIDATE,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/EmailValidate.vue"),
|
2020-02-13 15:48:12 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiresAuth: false,
|
2022-07-12 10:55:28 +02:00
|
|
|
announcer: { message: (): string => t("Email validate") as string },
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
2020-02-13 15:48:12 +01:00
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
{
|
2020-02-18 08:57:00 +01:00
|
|
|
path: "/validate/:token",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.VALIDATE,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/ValidateUser.vue"),
|
2019-02-25 17:20:06 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiresAuth: false,
|
|
|
|
announcer: {
|
2022-07-12 10:55:28 +02:00
|
|
|
message: (): string => t("Validating account") as string,
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
|
|
|
{
|
2020-02-18 08:57:00 +01:00
|
|
|
path: "/login",
|
2019-02-22 14:55:47 +01:00
|
|
|
name: UserRouteName.LOGIN,
|
2022-07-12 10:55:28 +02:00
|
|
|
component: (): Promise<any> => import("@/views/User/LoginView.vue"),
|
2019-02-22 11:24:41 +01:00
|
|
|
props: true,
|
2021-10-10 16:24:12 +02:00
|
|
|
meta: {
|
|
|
|
requiredAuth: false,
|
2022-07-12 10:55:28 +02:00
|
|
|
announcer: { message: (): string => t("Login") as string },
|
2021-10-10 16:24:12 +02:00
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
},
|
2023-02-15 19:31:23 +01:00
|
|
|
{
|
|
|
|
path: "/oauth/autorize_approve",
|
|
|
|
name: UserRouteName.OAUTH_AUTORIZE,
|
|
|
|
component: (): Promise<any> => import("@/views/OAuth/AuthorizeView.vue"),
|
|
|
|
meta: {
|
|
|
|
requiredAuth: true,
|
|
|
|
announcer: {
|
|
|
|
message: (): string => t("Authorize application") as string,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2023-02-21 14:50:09 +01:00
|
|
|
{
|
|
|
|
path: "/login/device",
|
|
|
|
name: UserRouteName.OAUTH_LOGIN_DEVICE,
|
|
|
|
component: (): Promise<any> =>
|
|
|
|
import("@/views/OAuth/DeviceActivationView.vue"),
|
|
|
|
meta: {
|
|
|
|
requiredAuth: true,
|
|
|
|
announcer: {
|
|
|
|
message: (): string => t("Device activation") as string,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
},
|
2019-02-22 11:24:41 +01:00
|
|
|
];
|