From e8e8d08d981d452ac1187392d9665e507bfc0848 Mon Sep 17 00:00:00 2001 From: Christoph Haas Date: Mon, 9 Nov 2020 20:26:34 +0100 Subject: [PATCH] wip: mail... --- assets/js/custom.js | 9 +- assets/tpl/admin_create_clients.html | 10 +- assets/tpl/admin_edit_client.html | 10 +- assets/tpl/admin_edit_interface.html | 10 +- assets/tpl/admin_index.html | 38 +++-- assets/tpl/email.html | 187 ++++++++++++++++++++++++ assets/tpl/prt_nav.html | 4 +- go.mod | 4 +- go.sum | 24 ++- internal/common/email.go | 79 ++++++++++ internal/server/core.go | 20 ++- internal/server/handlers.go | 141 ++++++++++++++++-- internal/server/handlers_auth.go | 2 +- internal/server/routes.go | 3 + internal/server/usermanager.go | 122 +++++++++++++++- internal/wireguard/template.go | 210 +++++++++++++++++++++++++++ 16 files changed, 801 insertions(+), 72 deletions(-) create mode 100644 assets/tpl/email.html create mode 100644 internal/common/email.go diff --git a/assets/js/custom.js b/assets/js/custom.js index dee0777..8534ac4 100644 --- a/assets/js/custom.js +++ b/assets/js/custom.js @@ -10,12 +10,9 @@ e.preventDefault(); }); + $(function () { + $('[data-toggle="tooltip"]').tooltip() + }); })(jQuery); // End of use strict -function OnSearch(input) { - if(input.value === "") { - window.location = "/?search="; - } -} - diff --git a/assets/tpl/admin_create_clients.html b/assets/tpl/admin_create_clients.html index 81e5987..a0eb6cf 100644 --- a/assets/tpl/admin_create_clients.html +++ b/assets/tpl/admin_create_clients.html @@ -20,14 +20,8 @@

Create new clients

Enter valid LDAP user email addresses to quickly create new accounts.

{{if $.Alerts.HasAlert}} -
-
-
- -
-
+ {{end}} diff --git a/assets/tpl/admin_edit_client.html b/assets/tpl/admin_edit_client.html index b245304..c549c94 100644 --- a/assets/tpl/admin_edit_client.html +++ b/assets/tpl/admin_edit_client.html @@ -21,14 +21,8 @@ {{end}} {{if $.Alerts.HasAlert}} -
-
-
- -
-
+ {{end}} diff --git a/assets/tpl/admin_edit_interface.html b/assets/tpl/admin_edit_interface.html index c816e60..dd2238f 100644 --- a/assets/tpl/admin_edit_interface.html +++ b/assets/tpl/admin_edit_interface.html @@ -17,14 +17,8 @@

Edit interface {{.Device.DeviceName}}

{{if $.Alerts.HasAlert}} -
-
-
- -
-
+ {{end}} diff --git a/assets/tpl/admin_index.html b/assets/tpl/admin_index.html index 7f81adc..717218d 100644 --- a/assets/tpl/admin_index.html +++ b/assets/tpl/admin_index.html @@ -15,12 +15,18 @@ {{template "prt_nav.html" .}}

WireGuard VPN Administration

- + {{if $.Alerts.HasAlert}} + + {{end}}
Interface status for {{.Device.DeviceName}} - + +     +
@@ -44,6 +50,10 @@ Enabled Peers: {{len .Device.Interface.Peers}} + + Total Peers: + {{.TotalPeers}} +
@@ -79,11 +89,11 @@
-

Current VPN Users

+

Current VPN Users

-
- - M +
+ + M
@@ -95,7 +105,7 @@ Public Key E-Mail IP's - Last Handshake + Handshake @@ -110,11 +120,7 @@ {{$p.PublicKey}} {{$p.Email}} {{$p.IPsStr}} - {{if not $p.Peer}} - ? - {{else}} - {{if $p.DeactivatedAt}}-{{else}}{{$p.Peer.LastHandshakeTime}}{{end}} - {{end}} + {{$p.LastHandshake}} {{if eq $.Session.IsAdmin true}} @@ -166,9 +172,15 @@
-
+
+
+
+ Download + Email +
+
diff --git a/assets/tpl/email.html b/assets/tpl/email.html new file mode 100644 index 0000000..4231e48 --- /dev/null +++ b/assets/tpl/email.html @@ -0,0 +1,187 @@ + + + + + + + + + + + + + + + Email Template + + + + + + + + + + +
+ + + + +
+ + + + + + +
+ + + + +
+ + + + + + +
+ + + + +
+
+ + + {{if not .Client.LdapUser}} + + {{else}} + + {{end}} + + + + +
Hello {{.Client.LdapUser.Firstname}} {{.Client.LdapUser.Lastname}}Hello
You or your administrator probably requested this VPN configuration. Scan the Qrcode or open the attached configuration file ({{.Client.GetConfigFileName}}) in the WireGuard VPN client to establish a secure VPN connection.
+
+
+
+ + + + + + + +
+ + + + +
+ + + + +
+ + + + + + + + + + + + +
About WireGuard
WireGuard is an extremely simple yet fast and modern VPN that utilizes state-of-the-art cryptography. It aims to be faster, simpler, leaner, and more useful than IPsec, while avoiding the massive headache. It intends to be considerably more performant than OpenVPN.
+ + + + +
Download WireGuard VPN Client
+
+
+
+
+ + + + + + + +
+ + + + + + + +
This mail was generated using WireGuard Portal.
Visit WireGuard Portal
+
+ +
+
+ + \ No newline at end of file diff --git a/assets/tpl/prt_nav.html b/assets/tpl/prt_nav.html index d0772e6..1ff1697 100644 --- a/assets/tpl/prt_nav.html +++ b/assets/tpl/prt_nav.html @@ -8,8 +8,8 @@