Skip to content

Commit

Permalink
bumped canvas to version 2.1.x
Browse files Browse the repository at this point in the history
  • Loading branch information
lpinca committed Nov 30, 2018
1 parent e2c700d commit 2c3a8f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 8 deletions.
11 changes: 4 additions & 7 deletions lib/captcha.js
Original file line number Diff line number Diff line change
@@ -1,19 +1,16 @@
'use strict';

/**
* Module dependencies.
*/
const { createCanvas } = require('canvas');

var canvas = require('canvas')
, characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';
const characters = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789';

/**
* Captcha constructor.
*/

function Captcha() {
this.code = '';
this.canvas = new canvas(74, 26);
this.canvas = createCanvas(74, 26);
this.initialize();
}

Expand All @@ -26,7 +23,7 @@ Captcha.prototype.initialize = function() {
this.code += characters[Math.floor(Math.random() * characters.length)];
}

var ctx = this.canvas.getContext('2d');
const ctx = this.canvas.getContext('2d');

ctx.fillStyle = '#DDDDDD';
ctx.fillRect(0, 0, 74, 26);
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"dependencies": {
"async": "2.6.x",
"body-parser": "1.18.x",
"canvas": "1.6.x",
"canvas": "2.1.x",
"connect-redis": "3.3.x",
"cookie-parser": "1.4.x",
"express": "4.16.x",
Expand Down

0 comments on commit 2c3a8f5

Please sign in to comment.