<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <meta name="robots" content="noindex">
    <title>{{ .title }} RDP</title>
    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/fomantic-ui@2.8.4/dist/semantic.min.css">
    <link rel="stylesheet" href="/css/tunnel-proxy.css">
</head>

<body>
    <div class="wrapper">
        <div class="connect">
            <h3 class="ui dividing header">Remote Desktop Client</h3>

            <form action="/createToken" method="POST" class="ui form">
                <div class="field">
                    <label for="username">Username</label>
                    <input name="username" id="username" placeholder="Username" value="{{.username}}">
                </div>
                <div class="field">
                    <label for="password">Password</label>
                    <input type="password" name="password" id="password" placeholder="Password" autofocus>
                </div>
                <div class="field">
                    <label for="domain">Domain</label>
                    <input name="domain" id="domain" placeholder="Domain" value="{{.domain}}">
                </div>
                <div class="field">
                    <div class="ui labeled input">
                        <div class="ui label">Security</div>
                        <select class="ui selection dropdown" id="security" name="security">
                            {{ range .securityOptions }}
                                {{ if .Selected}}
                                    <option value="{{ .Value }}" selected="selected">{{ .Description }}</option>
                                {{ else}}
                                    <option value="{{ .Value }}">{{ .Description }}</option>
                                {{ end }}
                            {{ end }}
                        </select>
                    </div>
                </div>
                <div class="field">
                    <div class="ui labeled input">
                        <div class="ui label">Keyboard</div>
                        <select class="ui selection dropdown" id="keyboard" name="keyboard">
                            {{ range .keyboardOptions }}
                            {{ if .Selected}}
                            <option value="{{ .Value }}" selected="selected">{{ .Description }}</option>
                            {{ else}}
                            <option value="{{ .Value }}">{{ .Description }}</option>
                            {{ end }}
                            {{ end }}
                        </select>
                    </div>
                </div>

                <input type="hidden" name="width" id="width" value="{{.width}}"/>
                <input type="hidden" name="height" id="height" value="{{.height}}"/>

                <input class="ui button primary" type="submit" value="Connect">

            </form>
            {{ if .isError }}
            <div class="ui divider"></div>
            <div class="ui message red">{{ .errorMessage }}</div>
            {{ end }}
            <div class="ui divider"></div>
            <div class="ui message">Credentials are passed through and not stored.</div>
        </div>
    </div>
</body>

</html>