mirror of
https://github.com/codeninjasllc/codecombat.git
synced 2025-02-17 08:50:58 -05:00
Only generate lowercase prepaid codes
Will be easier to make them case-insensitive later if needed.
This commit is contained in:
parent
5ff3b1606c
commit
32441f1c8d
2 changed files with 2 additions and 2 deletions
|
@ -51,7 +51,7 @@ function generateNewCode(done)
|
|||
function createCode(length)
|
||||
{
|
||||
var text = "";
|
||||
var possible = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
||||
var possible = "abcdefghijklmnopqrstuvwxyz0123456789";
|
||||
|
||||
for( var i=0; i < length; i++ )
|
||||
text += possible.charAt(Math.floor(Math.random() * possible.length));
|
||||
|
|
|
@ -6,7 +6,7 @@ PrepaidSchema.index({code: 1}, { unique: true })
|
|||
|
||||
PrepaidSchema.statics.generateNewCode = (done) ->
|
||||
tryCode = ->
|
||||
code = _.sample("ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", 8).join('')
|
||||
code = _.sample("abcdefghijklmnopqrstuvwxyz0123456789", 8).join('')
|
||||
Prepaid.findOne code: code, (err, prepaid) ->
|
||||
return done() if err
|
||||
return done(code) unless prepaid
|
||||
|
|
Loading…
Reference in a new issue