-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathackSvcAccReset.tmpl
More file actions
52 lines (50 loc) · 1.5 KB
/
ackSvcAccReset.tmpl
File metadata and controls
52 lines (50 loc) · 1.5 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
<html>
<head>
<title>{{.AppName}}</title>
<link rel="stylesheet" href="/static/style.css">
<style>
.pw:not(:hover), .pw:not(:hover) * {
color:transparent !important;
}
.pw:not(:hover) {
text-shadow:0 0 12px #4D5763;
}
.pw {
transition:color 0.25s ease, text-shadow 0.25s ease;
}
.pw * {
transition:color 0.25s ease;
}
</style>
</head>
<body>
<div class='box'>
<img src='/static/logo.png'>
{{if .Success}}
<h1 class='h1-password'>Success!</h1>
<p>New password for {{.Username}}: <span class="pw">{{.Password}}</span></p>
<p><button class="js-copypwbtn">Copy Password To Clipboard</button></p>
{{else}}
<h1 class='h1-password'>Error!</h1>
<p>An error occured while settings your password. Error: {{.ErrMessage}}</p>
{{end}}
</div>
</body>
<script>
var copyPwBtn = document.querySelector('.js-copypwbtn');
copyPwBtn.addEventListener('click', function(event) {
var password = document.querySelector('.pw');
var range = document.createRange();
range.selectNode(password);
window.getSelection().addRange(range);
try {
var successful = document.execCommand('copy');
var msg = successful ? 'successful' : 'unsuccessful';
console.log('Copy command was ' + msg);
} catch(err) {
console.log('unable to copy');
}
window.getSelection().removeAllRanges();
});
</script>
</html>