Implemented email verification
This commit is contained in:
@@ -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)
|
||||
}
|
||||
Reference in New Issue
Block a user