Skip to content
This repository has been archived by the owner on Jan 3, 2022. It is now read-only.

Commit

Permalink
Repair generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Neztore committed Aug 2, 2020
1 parent ba32783 commit ea8681d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "polaris-website",
"version": "1.1.0",
"version": "1.1.1",
"description": "The Polaris website and panel designed to work with the Polaris bot (polaris-bot package)",
"main": "src/server/index.js",
"scripts": {
Expand Down
6 changes: 3 additions & 3 deletions src/server/csrf.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,13 @@ function generateToken (length = 100){
if (err) {
return reject(err);
}
const token = buffer.toString("hex");
const token = buffer.toString("base64");
return resolve(token.substr(0, length));
});
}));
}
const protectedMethods = ["post", "patch", "put", "delete"];
module.exports = function (req, res, next) {
module.exports = async function (req, res, next) {
function fail () {
return res.status(400).send({
error: {
Expand All @@ -36,7 +36,7 @@ module.exports = function (req, res, next) {
} else {
// It's a get
if (!req.cookies["CSRF-Token"]) {
res.cookie("CSRF-Token", generateToken(20), {
res.cookie("CSRF-Token", await generateToken(20), {
maxAge: 172800000,
sameSite: "strict",
httpOnly: false
Expand Down

0 comments on commit ea8681d

Please sign in to comment.