Newer
Older
wg-portal / assets / tpl / admin_edit_client.html
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, shrink-to-fit=no">
    <title>{{ .Static.WebsiteTitle }} - Admin</title>
    <meta name="description" content="{{ .Static.WebsiteTitle }}">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <link rel="stylesheet" href="/fonts/fontawesome-all.min.css">
    <link rel="stylesheet" href="/css/custom.css">
</head>

<body id="page-top" class="d-flex flex-column min-vh-100">
    {{template "prt_nav.html" .}}
    <div class="container mt-5">
        {{template "prt_flashes.html" .}}

        <!-- server mode -->
        {{if eq .Device.Type "server"}}
        {{if .Peer.IsNew}}
            <h1>Create a new client</h1>
        {{else}}
            <h1>Edit client: <strong>{{.Peer.Identifier}}</strong></h1>
        {{end}}

        <form method="post" enctype="multipart/form-data">
            <input type="hidden" name="_csrf" value="{{.Csrf}}">
            <input type="hidden" name="uid" value="{{.Peer.UID}}">
            <input type="hidden" name="devicetype" value="{{.Device.Type}}">
            <input type="hidden" name="device" value="{{.Device.DeviceName}}">
            <input type="hidden" name="endpoint" value="{{.Peer.Endpoint}}">
            {{if .EditableKeys}}
                <div class="form-row">
                    <div class="form-group col-md-12">
                        <label for="server_PrivateKey">Private Key</label>
                        <input type="text" name="privkey" class="form-control" id="server_PrivateKey" value="{{.Peer.PrivateKey}}">
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group required col-md-12">
                        <label for="server_PublicKey">Public Key</label>
                        <input type="text" name="pubkey" class="form-control" id="server_PublicKey" value="{{.Peer.PublicKey}}" required>
                    </div>
                </div>
                <div class="form-row">
                    <div class="form-group col-md-12">
                        <label for="server_PresharedKey">Preshared Key</label>
                        <input type="text" name="presharedkey" class="form-control" id="server_PresharedKey" value="{{.Peer.PresharedKey}}" required>
                    </div>
                </div>
            {{else}}
                <input type="hidden" name="privkey" value="{{.Peer.PrivateKey}}">
                <input type="hidden" name="presharedkey" value="{{.Peer.PresharedKey}}">
                <div class="form-row">
                    <div class="form-group col-md-12">
                        <label for="server_ro_PublicKey">Public Key</label>
                        <input type="text" name="pubkey" readonly class="form-control" id="server_ro_PublicKey" value="{{.Peer.PublicKey}}">
                    </div>
                </div>
            {{end}}
            <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="server_Identifier">Client Friendly Name</label>
                    <input type="text" name="identifier" class="form-control" id="server_Identifier" value="{{.Peer.Identifier}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="server_Email">Client Email Address</label>
                    <input type="email" name="mail" class="form-control" id="server_Email" value="{{.Peer.Email}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="server_IP">Client IP Address</label>
                    <input type="text" name="ip" class="form-control" id="server_IP" value="{{.Peer.IPsStr}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-12 global-config">
                    <label for="server_AllowedIP">Allowed IPs</label>
                    <input type="text" name="allowedip" class="form-control" id="server_AllowedIP" value="{{.Peer.AllowedIPsStr}}">
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-12 global-config">
                    <label for="server_DNS">Client DNS Servers</label>
                    <input type="text" name="dns" class="form-control" id="server_DNS" value="{{.Peer.DNSStr}}">
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-6 global-config">
                    <label for="server_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
                    <input type="number" name="keepalive" class="form-control" id="server_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
                </div>
                <div class="form-group col-md-6 global-config">
                    <label for="server_MTU">Client MTU (0 = default)</label>
                    <input type="number" name="mtu" class="form-control" id="server_MTU" placeholder="" value="{{.Peer.Mtu}}">
                </div>
            </div>

            <div class="form-row">
                <div class="form-group col-md-12">
                    <div class="custom-control custom-switch">
                        <input class="custom-control-input" name="isdisabled" type="checkbox" value="true" id="server_Disabled" {{if .Peer.DeactivatedAt}}checked{{end}}>
                        <label class="custom-control-label" for="server_Disabled">
                            Disabled
                        </label>
                    </div>
                    <div class="custom-control custom-switch">
                        <input class="custom-control-input" name="ignoreglobalsettings" type="checkbox" value="true" id="server_IgnoreGlobalSettings" {{if .Peer.IgnoreGlobalSettings}}checked{{end}}>
                        <label class="custom-control-label" for="server_IgnoreGlobalSettings">
                            Ignore global settings (<span class="text-blue">g</span>)
                        </label>
                    </div>
                </div>
            </div>


            <button type="submit" class="btn btn-primary">Save</button>
            <a href="/admin" class="btn btn-secondary">Cancel</a>
        </form>
        {{end}}

        <!-- client mode -->
        {{if eq .Device.Type "client"}}
        {{if .Peer.IsNew}}
        <h1>Create a new remote endpoint</h1>
        {{else}}
        <h1>Edit remote endpoint: <strong>{{.Peer.Identifier}}</strong></h1>
        {{end}}

        <form method="post" enctype="multipart/form-data">
            <input type="hidden" name="_csrf" value="{{.Csrf}}">
            <input type="hidden" name="uid" value="{{.Peer.UID}}">
            <input type="hidden" name="mail" value="{{.AdminEmail}}">
            <input type="hidden" name="devicetype" value="{{.Device.Type}}">
            <input type="hidden" name="device" value="{{.Device.DeviceName}}">
            <input type="hidden" name="privkey" value="{{.Peer.PrivateKey}}">
                        <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="client_Identifier">Endpoint Friendly Name</label>
                    <input type="text" name="identifier" class="form-control" id="client_Identifier" value="{{.Peer.Identifier}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="client_Endpoint">Endpoint Address</label>
                    <input type="text" name="endpoint" class="form-control" id="client_Endpoint" value="{{.Peer.Endpoint}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group required col-md-12">
                    <label for="client_PublicKey">Endpoint Public Key</label>
                    <input type="text" name="pubkey" class="form-control" id="client_PublicKey" value="{{.Peer.PublicKey}}" required>
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-12">
                    <label for="client_PresharedKey">Preshared Key</label>
                    <input type="text" name="presharedkey" class="form-control" id="client_PresharedKey" value="{{.Peer.PresharedKey}}">
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-12">
                    <label for="client_AllowedIP">Allowed IPs</label>
                    <input type="text" name="allowedip" class="form-control" id="client_AllowedIP" value="{{.Peer.AllowedIPsStr}}">
                </div>
            </div>
            <div class="form-row">
                <div class="form-group col-md-6">
                    <label for="client_PersistentKeepalive">Persistent Keepalive (0 = off)</label>
                    <input type="number" name="keepalive" class="form-control" id="client_PersistentKeepalive" placeholder="16" value="{{.Peer.PersistentKeepalive}}">
                </div>
                <div class="form-row">
                    <div class="form-group col-md-6">
                        <label for="client_IP">Ping-Check IP Address</label>
                        <input type="text" name="ip" class="form-control" id="client_IP" value="{{.Peer.IPsStr}}">
                    </div>
                </div>
            </div>

            <div class="form-row">
                <div class="form-group col-md-12">
                    <div class="custom-control custom-switch">
                        <input class="custom-control-input" name="isdisabled" type="checkbox" value="true" id="client_Disabled" {{if .Peer.DeactivatedAt}}checked{{end}}>
                        <label class="custom-control-label" for="client_Disabled">
                            Disabled
                        </label>
                    </div>
                </div>
            </div>


            <button type="submit" class="btn btn-primary">Save</button>
            <a href="/admin" class="btn btn-secondary">Cancel</a>
        </form>
        {{end}}
    </div>
    {{template "prt_footer.html" .}}
    <script src="/js/jquery.min.js"></script>
    <script src="/js/bootstrap.bundle.min.js"></script>
    <script src="/js/jquery.easing.js"></script>
    <script src="/js/custom.js"></script>
</body>

</html>