Implemented email verification

This commit is contained in:
2024-04-12 13:52:16 +03:00
parent 78107d4ec7
commit b1ad7b5c3e
51 changed files with 604 additions and 213 deletions

View File

@@ -1,10 +1,11 @@
import { locales } from '@/config/locales'
import { UUID_V4_REGEX } from '@/config/validation'
export const USER_PROFILE_URL: string = '/cabinet'
export const AUTH_LOGIN_URL: string = '/auth/login'
export const AUTH_REGISTER_URL: string = '/auth/register'
export const AUTH_ERROR_URL: string = '/auth/error'
export const AUTH_EMAIL_VERIFICATION_URL: string = '/auth/email-verification'
export const AUTH_USER_VERIFICATION_URL: string = '/auth/user-verification/'
/**
* An array of routes that accessible to the public.
@@ -12,7 +13,7 @@ export const AUTH_EMAIL_VERIFICATION_URL: string = '/auth/email-verification'
* @type {string[]}
*/
export const publicRoutes: string[] = [
'/', '/about']
'/', '/about', `${AUTH_USER_VERIFICATION_URL}${UUID_V4_REGEX}`]
/**
* An array of routes that are used for authentication.
@@ -20,7 +21,7 @@ export const publicRoutes: string[] = [
* @type {string[]}
*/
export const authRoutes: string[] = [
AUTH_LOGIN_URL, AUTH_REGISTER_URL, AUTH_ERROR_URL, AUTH_EMAIL_VERIFICATION_URL]
AUTH_LOGIN_URL, AUTH_REGISTER_URL, AUTH_ERROR_URL]
/**
* The prefix for API authentication routes.
@@ -39,6 +40,5 @@ export const testPathnameRegex = (
pages: string[], pathName: string): boolean => {
const pattern: string = `^(/(${locales.join('|')}))?(${pages.flatMap(
(p) => (p === '/' ? ['', '/'] : p)).join('|')})/?$`
return RegExp(pattern, 'is').test(pathName)
}