17 lines
496 B
JavaScript
17 lines
496 B
JavaScript
const secretNums = [null, -2.5, 6.9, 4.2069]
|
|
|
|
function validate (level, username, code) {
|
|
for (let i = level; i < secretNums.length; i++) {
|
|
if (getCode(level, username) === code) {
|
|
return true
|
|
}
|
|
}
|
|
return false
|
|
}
|
|
|
|
function getCode (level, username = ' ') {
|
|
const date = new Date()
|
|
return String.fromCharCode(Math.floor((date.getDate() + date.getMinutes() - date.getMonth()) / secretNums[level] * username.length * 69))
|
|
}
|
|
|
|
module.exports = { secretNums, validate, getCode }
|