mirror of
https://github.com/Threnklyn/wg-ui.git
synced 2026-06-03 20:28:28 +02:00
Optional generation Preshared Key when creating a new client. (#140)
* Added support for Pre-shared Key. Modified Create to generate a PSK should that be required. Included Preshared key in Config/QR if it applies. Show PSK on EditClient Page. * Fix formatting on existing code. * Remove unused err variable
This commit is contained in:
Generated
+54
@@ -3028,6 +3028,21 @@
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
},
|
||||
"@material/form-field": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@material/form-field/-/form-field-3.2.0.tgz",
|
||||
"integrity": "sha512-4XjZGy1S966IOUxFaRAKcZOvr5qqvx8r1RMvfCsEzTB45y9Lo2puilNyCtatVAULRxCwszZb7Kbd++cpmMpzZA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@material/base": "^3.1.0",
|
||||
"@material/feature-targeting": "^3.1.0",
|
||||
"@material/ripple": "^3.2.0",
|
||||
"@material/rtl": "^3.2.0",
|
||||
"@material/theme": "^3.1.0",
|
||||
"@material/typography": "^3.1.0",
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
},
|
||||
"@material/icon-button": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@material/icon-button/-/icon-button-3.2.0.tgz",
|
||||
@@ -3097,6 +3112,23 @@
|
||||
"@material/feature-targeting": "^3.1.0"
|
||||
}
|
||||
},
|
||||
"@material/switch": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@material/switch/-/switch-3.2.0.tgz",
|
||||
"integrity": "sha512-gECImbvf3HGpmc/Sj2Meq+z7/ri5jmD5rKOeUUeC6nZ77/HiGCRhmSD66rlS0SH5qUUj0mWSbE8ZVOJmVWySEQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@material/animation": "^3.1.0",
|
||||
"@material/base": "^3.1.0",
|
||||
"@material/dom": "^3.1.0",
|
||||
"@material/elevation": "^3.1.0",
|
||||
"@material/feature-targeting": "^3.1.0",
|
||||
"@material/ripple": "^3.2.0",
|
||||
"@material/rtl": "^3.2.0",
|
||||
"@material/theme": "^3.1.0",
|
||||
"tslib": "^1.9.3"
|
||||
}
|
||||
},
|
||||
"@material/textfield": {
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/@material/textfield/-/textfield-3.2.0.tgz",
|
||||
@@ -3262,6 +3294,18 @@
|
||||
"@smui/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@smui/form-field": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@smui/form-field/-/form-field-1.1.0.tgz",
|
||||
"integrity": "sha512-O0+D/qemxCHbB/fcBmAlkYCw4GAV6Q1okZxDymMfmTPSG2MOAAGBKkaN1O0LYBLZpb+TmNWae4avPNcrzwCNvQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@material/feature-targeting": "^3.1.0",
|
||||
"@material/form-field": "^3.2.0",
|
||||
"@material/rtl": "^3.2.0",
|
||||
"@smui/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@smui/icon-button": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@smui/icon-button/-/icon-button-1.0.0.tgz",
|
||||
@@ -3316,6 +3360,16 @@
|
||||
"@material/ripple": "^3.2.0"
|
||||
}
|
||||
},
|
||||
"@smui/switch": {
|
||||
"version": "1.1.0",
|
||||
"resolved": "https://registry.npmjs.org/@smui/switch/-/switch-1.1.0.tgz",
|
||||
"integrity": "sha512-drly1s1/y/NZ+25AUoVuSUZnCh33aDNDzdIkPz4EOCP+ZAQWJLgJwP7WII1WXL8ggjc8ZReGXmjLuqa7+ZsEYQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@material/switch": "^3.2.0",
|
||||
"@smui/common": "^1.0.0"
|
||||
}
|
||||
},
|
||||
"@smui/textfield": {
|
||||
"version": "1.0.0",
|
||||
"resolved": "https://registry.npmjs.org/@smui/textfield/-/textfield-1.0.0.tgz",
|
||||
|
||||
@@ -22,8 +22,10 @@
|
||||
"@smui/button": "^1.0.0",
|
||||
"@smui/dialog": "^1.0.0",
|
||||
"@smui/fab": "^1.0.0",
|
||||
"@smui/form-field": "^1.0.0",
|
||||
"@smui/icon-button": "^1.0.0",
|
||||
"@smui/paper": "^1.0.0",
|
||||
"@smui/switch": "^1.0.0",
|
||||
"@smui/textfield": "^1.0.0",
|
||||
"@smui/top-app-bar": "^1.0.0",
|
||||
"babel-jest": "^24.9.0",
|
||||
|
||||
@@ -108,6 +108,8 @@
|
||||
<dd>{client.PrivateKey}</dd>
|
||||
<dt>Public Key</dt>
|
||||
<dd>{client.PublicKey}</dd>
|
||||
<dt>Preshared Key</dt>
|
||||
<dd>{client.PresharedKey}</dd>
|
||||
</dl>
|
||||
</div>
|
||||
|
||||
|
||||
+11
-2
@@ -5,7 +5,8 @@
|
||||
import HelperText from '@smui/textfield/helper-text/index';
|
||||
import Button, {Group, GroupItem} from '@smui/button';
|
||||
import Paper, {Title, Subtitle, Content} from '@smui/paper';
|
||||
|
||||
import Switch from '@smui/switch';
|
||||
import FormField from '@smui/form-field'
|
||||
import Cookie from "cookie-universal";
|
||||
import { onMount } from 'svelte';
|
||||
import { link, navigate } from "svelte-routing";
|
||||
@@ -17,11 +18,13 @@
|
||||
let client = {};
|
||||
let clientName = "";
|
||||
let clientNotes = "";
|
||||
let generatePSK = false;
|
||||
let deleteDialog;
|
||||
|
||||
async function handleSubmit(event) {
|
||||
client.Name = clientName;
|
||||
client.Notes = clientNotes;
|
||||
client.generatePSK = generatePSK;
|
||||
const res = await fetch(clientsUrl, {
|
||||
method: "POST",
|
||||
headers: {
|
||||
@@ -78,7 +81,13 @@
|
||||
<Textfield input$id="notes" fullwidth textarea bind:value={clientNotes} label="Label" input$aria-controls="client-notes" input$aria-describedby="client-notes-help" />
|
||||
<HelperText id="client-notes-help">Notes about the client.</HelperText>
|
||||
</div>
|
||||
|
||||
<div class="margins">
|
||||
<FormField style="margin-bottom: 2em;">
|
||||
<Switch bind:checked={generatePSK} />
|
||||
<span slot="label">Generate a Pre-shared Key</span>
|
||||
</FormField>
|
||||
</div>
|
||||
|
||||
<Button variant="raised"><Label>Create</Label></Button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user