-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
104 lines (95 loc) · 3.45 KB
/
index.html
File metadata and controls
104 lines (95 loc) · 3.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
<!doctype html>
<html lang="ja">
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>パスワードメーカー</title>
<link rel="stylesheet" href="css/bootstrap.css">
</head>
<body class="bg-light">
<div class="container">
<div class="row" id="app">
<div class="col-12 pt-5 pb-5 offset-6 bg-white">
<h1 class="text-center">パスワードメーカー</h1>
<input type="text" class="mt-5 form-control form-control-lg text-center" id="output" readonly :value="password">
<div class="row">
<div class="col-18 offset-3">
<h2 class="mt-5">カスタマイズ</h2>
<div class="row">
<div class="col-12">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="big_alpha" v-model="big_alpha">
<label class="form-check-label" for="big_alpha">英大文字</label>
</div>
</div>
<div class="col-12">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="small_alpha" v-model="small_alpha">
<label class="form-check-label" for="small_alpha">英小文字</label>
</div>
</div>
<div class="col-12">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="number" v-model="numbers">
<label class="form-check-label" for="number">数字</label>
</div>
</div>
<div class="col-12">
<div class="form-check form-switch">
<input class="form-check-input" type="checkbox" id="symbol" v-model="symbols">
<label class="form-check-label" for="symbol">記号</label>
</div>
</div>
</div>
<div class="d-flex mt-3">
<label for="length" class="col-form-label">文字数</label>
<div class="ms-3">
<input type="number" class="form-control" id="length" v-model="length">
</div>
</div>
<div class="mt-5 d-grid gap-2 col-12 mx-auto">
<button class="btn btn-outline-dark">作る</button>
</div>
</div>
</div>
</div>
</div>
</div>
<script src="https://unpkg.com/vue@next"></script>
<script>
const pMaker = {
data() {
return {
big_alpha: true,
small_alpha: true,
numbers: true,
symbols: true,
length: 10
}
},
computed: {
password() {
const big_alpha_string = 'ABCDEFGHJKLMNPQRSTUVWXYZ'
const small_alpha_string = 'abcdefghijkmnopqrstuvwxyz'
const number_string = '1234567890'
const symbol_string = '!@#$%^&*()'
let source = ''
source += (this.big_alpha ? big_alpha_string : '')
source += (this.small_alpha ? small_alpha_string : '')
source += (this.numbers ? number_string : '')
source += (this.symbols ? symbol_string : '')
if (!source) return '-'
let ret = ''
for(let i=0; i<this.length; i++) {
ret += source.substr(Math.floor(Math.random() * source.length), 1)
}
return ret
}
}
}
Vue.createApp(pMaker).mount('#app')
</script>
</body>
</html>