mirror of
https://github.com/Ride-The-Lightning/RTL.git
synced 2024-11-19 01:40:29 +01:00
Adding CSRF Header for Browser Extension (#1037)
Adding CSRF Header for Browser Extension
This commit is contained in:
parent
b8477e3613
commit
592074679b
@ -41,7 +41,10 @@ export class ExpressApplication {
|
||||
this.app.use(this.common.baseHref + '/api/ecl', eclRoutes);
|
||||
this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'frontend')));
|
||||
this.app.use((req, res, next) => {
|
||||
// For Angular App
|
||||
res.cookie('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : '');
|
||||
// For JQuery Browser Plugin
|
||||
res.setHeader('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : '');
|
||||
res.sendFile(join(this.directoryName, '../..', 'frontend', 'index.html'));
|
||||
});
|
||||
this.app.use((err, req, res, next) => this.handleApplicationErrors(err, res));
|
||||
|
@ -63,7 +63,10 @@ export class ExpressApplication {
|
||||
this.app.use(this.common.baseHref + '/api/ecl', eclRoutes);
|
||||
this.app.use(this.common.baseHref, express.static(join(this.directoryName, '../..', 'frontend')));
|
||||
this.app.use((req: any, res, next) => {
|
||||
// For Angular App
|
||||
res.cookie('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : '');
|
||||
// For JQuery Browser Plugin
|
||||
res.setHeader('XSRF-TOKEN', req.csrfToken ? req.csrfToken() : '');
|
||||
res.sendFile(join(this.directoryName, '../..', 'frontend', 'index.html'));
|
||||
});
|
||||
this.app.use((err, req, res, next) => this.handleApplicationErrors(err, res));
|
||||
|
Loading…
Reference in New Issue
Block a user