import Controller from "wms-core/Controller"; import {REQUIRE_AUTH_MIDDLEWARE} from "wms-core/auth/AuthComponent"; import {NextFunction, Request, Response} from "express"; export default class AccountController extends Controller { routes(): void { this.get('/account', this.getAccount, 'account', REQUIRE_AUTH_MIDDLEWARE); this.post('/add-recovery-email', this.addRecoveryEmail, 'add-recovery-email', REQUIRE_AUTH_MIDDLEWARE); } protected async getAccount(req: Request, res: Response, next: NextFunction): Promise { res.render('account', { emails: await req.models.user!.emails.get(), }); } protected async addRecoveryEmail(req: Request, res: Response, next: NextFunction): Promise { req.flash('warn', 'Not implemented'); res.redirectBack(); } }