public.ts 1.62 KB
Newer Older
Rosanny Sihombing's avatar
Rosanny Sihombing committed
1
import { publicController } from '../controller/publicController'
Rosanny Sihombing's avatar
Rosanny Sihombing committed
2

Rosanny Sihombing's avatar
Rosanny Sihombing committed
3
module.exports = function (app: any, config: any, lang: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
4
  // ================== NEW USERS REGISTRATION ======================
Rosanny Sihombing's avatar
Rosanny Sihombing committed
5
  app.get('/registration', function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
6
    publicController.showRegistrationPage(res, lang)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
7
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
8
  app.post('/registration', function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
9
    publicController.registerUser(req, res, config)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
10
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
11
  // to check whether or not an account is already exist
Rosanny Sihombing's avatar
Rosanny Sihombing committed
12
  app.get('/email/:email', async function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
13
    publicController.checkUserEmail(req, res)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
14
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
15
16
17

  // =================== USERS VERIFICATION =========================

Rosanny Sihombing's avatar
Rosanny Sihombing committed
18
  app.get('/verifyAccount', async function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
19
    publicController.verifyAccount(req, res, lang)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
20
21
22
23
  })

  // ==================== FORGOT PASSWORD ===========================

Rosanny Sihombing's avatar
Rosanny Sihombing committed
24
  app.get('/forgotPwd', function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
25
    publicController.showForgotPwdPage(req, res, lang)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
26
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
27
  app.post('/forgotPwd', function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
28
    publicController.generateNewToken(req, res, config)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
29
30
31
  })

  // reset
Rosanny Sihombing's avatar
Rosanny Sihombing committed
32
  app.get('/reset/:token', async function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
33
    publicController.showResetPassword(req, res, lang)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
34
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
35
  app.post('/reset/:token', async function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
36
    publicController.resetPassword(req, res)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
37
38
39
  })

  // ======================= CONTACT FORM ===========================
Rosanny Sihombing's avatar
Rosanny Sihombing committed
40
  app.get('/contact', function (req: any, res: any) {
Rosanny Sihombing's avatar
Rosanny Sihombing committed
41
    publicController.showContactPage(req, res, lang)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
42
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
43
44
  app.post('/contact', function (req: any, res: any) {
    publicController.sendContactMessage(req, res)
Rosanny Sihombing's avatar
Rosanny Sihombing committed
45
  })
Rosanny Sihombing's avatar
Rosanny Sihombing committed
46
}