add password challenge

This commit is contained in:
lesion 2018-08-26 23:43:06 +02:00
parent a418c4e86c
commit 3e9b76fb66
No known key found for this signature in database
GPG key ID: 352918250B012177
2 changed files with 14 additions and 11 deletions

View file

@ -1,6 +1,5 @@
const express = require('express') const express = require('express')
const router = express.Router() const router = express.Router()
const { fromTor, fromVpn, checkCountry } = require('./utils') const { fromTor, fromVpn, checkCountry } = require('./utils')
// magic // magic
@ -18,6 +17,10 @@ router.get('/metadata', render('metadata'))
// level IV (mail -> vpn) // level IV (mail -> vpn)
router.get('/mail', render('mail')) router.get('/mail', render('mail'))
router.get('/password', render('password'))
router.get('/fingerprint', render('fingerprint'))
// level V (vpn -> read mail) // level V (vpn -> read mail)
router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => { router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => {
if (!req.fromTor && req.fromVpn) { if (!req.fromTor && req.fromVpn) {
@ -27,6 +30,5 @@ router.get('/vpn', fromTor, fromVpn, checkCountry, (req, res, next) => {
} }
}) })
router.get('/password', render('password'))
module.exports = router module.exports = router

View file

@ -9,6 +9,7 @@ block content
li Tr0ub4dour&3 li Tr0ub4dour&3
br br
#app(v-cloak) #app(v-cloak)
form(action='/vpn')
input( input(
type='password', type='password',
v-model='password', v-model='password',
@ -53,11 +54,11 @@ block content
}, },
methods: { methods: {
checkStrength (e) { checkStrength (e) {
var estimation = zxcvbn(this.password) var estimation = zxcvbn(this.password, ['diocane', 'dioporco', 'porcodio', 'madonnacane'])
this.estimationScore = estimation.score; this.estimationScore = estimation.score;
this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize(); this.slowCrackTime = moment.duration(estimation.crack_times_seconds.offline_slow_hashing_1e4_per_second, 'seconds').humanize();
this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize(); this.fastCrackTime = moment.duration(estimation.crack_times_seconds.offline_fast_hashing_1e10_per_second, 'seconds').humanize();
this.sequence = estimation.sequence; this.sequence = estimation.sequence;
} },
} }
}) })