2
0
mirror of https://github.com/Ride-The-Lightning/RTL synced 2024-10-31 09:20:27 +00:00
RTL/backend/utils/csrf.js
ShahanaFarooqui 9c59954205
Release 0.12.1 (#932)
Offers QR Code bug fix
Websocket Authcheck csrf cookie validation
Bug Fix: Wrong year in Date #918
Improved INFO & DEBUG Logging
LND: Bug fix Color Setting in Config #925
2FA button toggle #906
Bug Fix: HTLC viewing #924
All Tooltips on form controls are updated with mat-icon:info

Co-authored-by: saiy2k <saiy2k@gmail.com>
2022-01-16 15:55:50 -05:00

21 lines
739 B
JavaScript

import csurf from 'csurf/index.js';
import { Logger } from './logger.js';
import { Common } from './common.js';
class CSRF {
constructor() {
this.csrfProtection = csurf({ cookie: true });
this.logger = Logger;
this.common = Common;
}
mount(app) {
this.logger.log({ selectedNode: this.common.initSelectedNode, level: 'INFO', fileName: 'CSRF', msg: 'Setting up CSRF..' });
if (process.env.NODE_ENV !== 'development') {
app.use((req, res, next) => this.csrfProtection(req, res, next));
}
this.logger.log({ selectedNode: this.common.initSelectedNode, level: 'INFO', fileName: 'CSRF', msg: 'CSRF Set' });
return app;
}
;
}
export default new CSRF;