We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent a302a12 commit e1cf1e4Copy full SHA for e1cf1e4
2 files changed
lib/config.js
@@ -1,5 +1,6 @@
1
'use strict'
2
3
+var crypto = require('crypto')
4
var dcopy = require('deep-copy')
5
6
// oauth configuration
@@ -48,7 +49,7 @@ exports.state = function (provider) {
48
49
state = provider.state.toString()
50
}
51
else if (typeof provider.state == 'boolean' && provider.state) {
- state = (Math.floor(Math.random() * 999999) + 1).toString()
52
+ state = crypto.randomBytes(10).toString('hex')
53
54
return state
55
test/config.js
@@ -78,7 +78,7 @@ describe('config', function () {
78
it('boolean true', function () {
79
var provider = {state:true}
80
, state = config.state(provider)
81
- state.should.match(/\d+/)
+ state.should.match(/^\w+$/)
82
state.should.be.type('string')
83
})
84
it('boolean false', function () {
0 commit comments