forked from github/dataease
Merge pull request #1957 from dataease/pr@dev@fix_link_pwd
fix: 增加公共链接密码强度
This commit is contained in:
commit
d5e5960054
@ -5,3 +5,14 @@ export function pdfTemplateReplaceAll(content, source, target) {
|
|||||||
return content
|
return content
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function randomRange(min, max) {
|
||||||
|
let returnStr = ''
|
||||||
|
const range = (max ? Math.round(Math.random() * (max - min)) + min : min)
|
||||||
|
const charStr = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789'
|
||||||
|
|
||||||
|
for (var i = 0; i < range; i++) {
|
||||||
|
var index = Math.round(Math.random() * (charStr.length - 1))
|
||||||
|
returnStr += charStr.substring(index, index + 1)
|
||||||
|
}
|
||||||
|
return returnStr
|
||||||
|
}
|
||||||
|
@ -77,6 +77,7 @@ import {
|
|||||||
shortUrl,
|
shortUrl,
|
||||||
setOverTime
|
setOverTime
|
||||||
} from '@/api/link'
|
} from '@/api/link'
|
||||||
|
import { randomRange } from '@/utils/StringUtils'
|
||||||
export default {
|
export default {
|
||||||
|
|
||||||
name: 'LinkGenerate',
|
name: 'LinkGenerate',
|
||||||
@ -171,14 +172,7 @@ export default {
|
|||||||
},
|
},
|
||||||
|
|
||||||
createPwd() {
|
createPwd() {
|
||||||
const randomNum = () => {
|
return randomRange(this.pwdNums)
|
||||||
return Math.floor(Math.random() * 10) + ''
|
|
||||||
}
|
|
||||||
let result = ''
|
|
||||||
for (let index = 0; index < this.pwdNums; index++) {
|
|
||||||
result += randomNum()
|
|
||||||
}
|
|
||||||
return result
|
|
||||||
},
|
},
|
||||||
|
|
||||||
resetPwd() {
|
resetPwd() {
|
||||||
|
Loading…
Reference in New Issue
Block a user