-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
111 lines (98 loc) · 4.24 KB
/
index.html
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
105
106
107
108
109
110
111
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>SAML2 Tenant Configuration</title>
<style>
body {
font-family: sans-serif;
margin: 0;
padding: 20px;
}
.container {
display: flex;
flex-direction: column;
gap: 10px;
}
.label {
font-weight: bold;
}
.output {
border: 1px solid #ccc;
padding: 10px;
font-size: 14px;
cursor: pointer;
}
.preview {
resize: none;
border: 1px solid #ccc;
padding: 10px;
font-size: 14px;
height: 50px;
/* Adjust height as needed */
background-color: #eee;
}
.info-text {
font-size: 12px;
color: #aaa;
}
</style>
</head>
<body>
<h1>SAML2 Tenant Configuration</h1>
<div class="container">
<div class="label">Command:</div>
<input type="text" id="command" value="php artisan saml2:create-tenant" readonly disabled>
<div class="label">* Key:</div>
<input type="text" id="key" value="" required>
<div class="info-text">The key must be unique (in case of several tenants).</div>
<div class="label">* entityId:</div>
<input type="text" id="entityId" value="" required>
<div class="label">* loginUrl:</div>
<input type="text" id="loginUrl" value="" required>
<div class="label">* logoutUrl:</div>
<input type="text" id="logoutUrl" value="" required>
<div class="label">* x509cert:</div>
<textarea id="x509cert" rows="4" required></textarea>
<div class="info-text">All line breaks will be removed before copying.</div>
<textarea id="preview" class="preview" disabled></textarea>
<div class="output" id="output">Copy to Clipboard</div>
</div>
<script>
const output = document.getElementById('output');
const key = document.getElementById('key');
const command = document.getElementById('command');
const entityId = document.getElementById('entityId');
const loginUrl = document.getElementById('loginUrl');
const logoutUrl = document.getElementById('logoutUrl');
const x509cert = document.getElementById('x509cert');
const preview = document.getElementById('preview');
// Pre-populate preview on page load with existing command values
const initialText = `${command.value} --key=${key.value} --entityId=${entityId.value} --loginUrl=${loginUrl.value} --logoutUrl=${logoutUrl.value} --x509cert=""`;
preview.value = initialText;
// Update preview on any input change
const updatePreview = () => {
const certWithoutCarriageReturns = x509cert.value.replace(/\n/g, '');
const text = `${command.value} --key=${key.value} --entityId=${entityId.value} --loginUrl=${loginUrl.value} --logoutUrl=${logoutUrl.value} --x509cert="${certWithoutCarriageReturns}"`;
preview.value = text;
};
// Attach updatePreview function to all relevant input events
key.addEventListener('input', updatePreview);
entityId.addEventListener('input', updatePreview);
loginUrl.addEventListener('input', updatePreview);
logoutUrl.addEventListener('input', updatePreview);
x509cert.addEventListener('input', updatePreview);
output.addEventListener('click', () => {
// Remove carriage returns from x509cert value
const certWithoutCarriageReturns = x509cert.value.replace(/\n/g, '');
const text = `${command.value} --key=${key.value} --entityId=${entityId.value} --loginUrl=${loginUrl.value} --logoutUrl=${logoutUrl.value} --x509cert="${certWithoutCarriageReturns}"` + '\n';
navigator.clipboard.writeText(text).then(() => {
output.textContent = 'Copied!';
}, () => {
output.textContent = 'Copy failed!';
});
});
</script>
</body>
</html>