指纹验证

This commit is contained in:
wanyongkang
2020-12-03 00:59:22 +08:00
parent 4ca40a7528
commit f3b71768b0
5 changed files with 52 additions and 286 deletions

View File

@@ -18,9 +18,7 @@
<script>
import QRCode from 'qrcodejs2'
import Fingerprint from './../../../../static/js/fingerprint.js'
let finger = new Fingerprint()
import FingerprintJS from '@fingerprintjs/fingerprintjs'
var that = null
export default {
@@ -38,14 +36,25 @@ export default {
methods: {
// 验证web指纹
confire_finger () {
let finger_code = finger.get()
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: finger_code}).then(res => {
if (res.msg == 'false') {
(async () => {
// We recommend to call `load` at application startup.
const fp = await FingerprintJS.load()
// The FingerprintJS agent is ready.
// Get a visitor identifier when you'd like to.
const result = await fp.get()
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: visitorId}).then(res => {
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + finger_code)
window.location.href = 'http://www.juip.com'
}
})
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
},
open () {
console.log(open)

View File

@@ -27,9 +27,9 @@
</section>
</template>
<script>
import Fingerprint from './../../../../static/js/fingerprint.js'
let finger = new Fingerprint()
import FingerprintJS from '@fingerprintjs/fingerprintjs'
export default {
components: {
@@ -65,14 +65,25 @@ export default {
// 验证web指纹
confire_finger () {
let finger_code = finger.get()
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: finger_code}).then(res => {
if (res.msg == 'false') {
(async () => {
// We recommend to call `load` at application startup.
const fp = await FingerprintJS.load()
// The FingerprintJS agent is ready.
// Get a visitor identifier when you'd like to.
const result = await fp.get()
// This is the visitor identifier:
const visitorId = result.visitorId
console.log(visitorId)
this.$api.post(this.$api.phpURL + 'api/Verify/index', {code: visitorId}).then(res => {
if (res.msg == 'false') {
// eslint-disable-next-line camelcase
alert('访问错误!错误码:' + finger_code)
window.location.href = 'http://www.juip.com'
}
})
alert('访问错误!错误码:' + visitorId)
window.location.href = 'http://www.juip.com'
}
})
})()
},
getMenus () {
this.$api