Hi… I am well aware that this diff view is very suboptimal. It will be fixed when the refactored server comes along!
Add basic stylesheet
body {
font-family: sans-serif;
margin: 0;
color: #444;
}
main {
main, #nav-inner {
padding: 0 5px; max-width: 800px; margin: 0 auto;
}
main {
padding-bottom: 20px;
}
nav {
border-bottom: 1px solid #eee;
}
nav h1 {
margin: 0;
padding: 10px 0;
font-size: 1.2em;
}
nav h1 a {
color: inherit;
text-decoration: none;
}
h2 {
font-size: 1.2em;
}
table {
border-collapse: collapse;
}
td, th {
border: 1px solid black;
border: 1px solid rgb(208, 210, 215);
padding: 5px; }
button {
border: 1px solid rgb(208, 210, 215);
border-radius: 4px;
padding: 6px 12px;
margin: 4px 0;
color: #444;
background-color: transparent;
cursor: pointer;
}
button:hover {
background-color: rgba(0, 0, 0, 0.02);
}
button[type="submit"]:not(.btn-regular):first-of-type {
background-color: rgb(0, 128, 0);
border-color: rgb(0, 128, 0);
color: white;
}
button[type="submit"]::not(.btn-regular):first-of-type:hover {
background-color: rgb(0, 150, 0);
border-color: rgb(0, 150, 0);
}
input[type="text"], input[type="password"], input[type="url"], textarea {
border: 1px solid rgb(208, 210, 215);
border-radius: 4px;
padding: 6px;
margin: 4px 0;
color: #444;
}
input[type="text"]:focus, input[type="password"]:focus, input[type="url"]:focus, textarea:focus {
outline: none;
border-color: rgb(0, 128, 0);
}
label {
display: block;
margin: 15px 0;
}
label input[type="text"], label input[type="password"], label input[type="url"] {
display: block;
width: 100%;
max-width: 350px;
box-sizing: border-box;
}
label:has(input[type="radio"]) {
margin: 5px 0;
}
label textarea {
display: block;
width: 100%;
resize: vertical;
}
main.narrow {
max-width: 400px;
}
main.narrow input {
max-width: 100%;
}
{{ template "head.html" .Base }}
<main>
<main class="narrow">
<h1>{{ .ServerName }}</h1>
<p>
Authorize
{{ if .Client.ClientURI }}
<a href="{{ .Client.ClientURI }}" target="_blank">
{{ end }}
{{- if .Client.ClientName -}}
{{- .Client.ClientName -}}
{{- else -}}
<code>{{- .Client.ClientID -}}</code>
{{- end -}}
{{- if .Client.ClientURI -}}
</a>
{{- end -}}
?
</p>
<form method="post" action="">
<button type="submit" name="authorize">Authorize</button>
<button type="submit" name="deny">Cancel</button>
</form>
</main>
{{ template "foot.html" }}
{{ template "head.html" .Base }}
{{ template "nav.html" .Base }}
<main>
<h1>{{ .ServerName }}</h1>
<h2>Client credentials</h2>
<p>
<strong>Client ID</strong>: <code>{{ .ClientID }}</code><br>
<strong>Client secret</strong>: <code>{{.ClientSecret}}</code>
</p>
<a href="/">Back</a>
<a href="/"><button type="button">Back</button></a>
</main>
{{ template "foot.html" }}
{{ template "head.html" .Base }}
{{ template "nav.html" .Base }}
<main>
<h1>{{ .ServerName }}</h1>
<p>Welcome, {{ .Me.Username }}!</p>
<form method="post">
<a href="/user/{{ .Me.ID }}"><button type="button">Settings</button></a>
<button type="submit" formaction="/logout">Logout</button>
<button type="submit" formaction="/logout" class="btn-regular">Logout</button>
</form>
<h2>Authorized clients</h2>
{{ with .AuthorizedClients }}
<table>
<tr>
<th>Client</th>
<th>Authorized until</th>
<th></th>
</tr>
{{ range . }}
<tr>
<td>
{{ with .Client }}
{{ if .ClientURI }}
<a href="{{ .ClientURI }}" target="_blank">
{{ end }}
{{ if .ClientName }}
{{ .ClientName }}
{{ else }}
<code>{{ .ClientID }}</code>
{{ end }}
{{ if .ClientURI }}
</a>
{{ end }}
{{ end }}
</td>
<td>{{ .ExpiresAt }}</td>
<td>
<form method="post" action="/client/{{ .Client.ID }}/revoke">
<button type="submit">Revoke</button>
</form>
</td>
</tr>
{{ end }}
</table>
{{ else }}
<p>No client authorized yet.</p>
{{ end }}
{{ if .Me.Admin }}
<h2>Registered clients</h2>
{{ with .Clients }}
<p>
<a href="/client/new"><button type="button">Register new client</button></a>
</p>
<p> <a href="/client/new"><button type="button">Register new client</button></a> </p>
{{ with .Clients }}
<table>
<tr>
<th>Client ID</th>
<th>Name</th>
</tr>
{{ range . }}
<tr>
<td><a href="/client/{{ .ID }}"><code>{{ .ClientID }}</code></a></td>
<td>{{ .ClientName }}</td>
</tr>
{{ end }}
</table>
{{ else }}
<p>No client registered yet.</p>
{{ end }}
<h2>Users</h2>
<p>
<a href="/user/new"><button type="button">Create user</button></a>
</p>
<table>
<tr>
<th>Username</th>
<th>Role</th>
</tr>
{{ range .Users }}
<tr>
<td><a href="/user/{{ .ID }}">{{ .Username }}</a></td>
<td>
{{ if .Admin }}
Administrator
{{ else }}
Regular user
{{ end}}
</td>
</tr>
{{ end }}
</table>
{{ end }}
</main>
{{ template "foot.html" }}
{{ template "head.html" .Base }}
<main>
<main class="narrow">
<h1>{{ .ServerName }}</h1>
<form method="post" action="">
Username: <input type="text" name="username" autocomplete="username"><br> Password: <input type="password" name="password"><br>
<label> Username <input type="text" name="username" autocomplete="username" autofocus> </label> <label> Password <input type="password" name="password"> </label>
<button type="submit">Login</button>
</form>
</main>
{{ template "foot.html" }}
{{ template "head.html" .Base }}
{{ template "nav.html" .Base }}
<main>
<h1>{{ .ServerName }}</h1>
<h2>
{{ if .Client.ID }}
Update client
{{ else }}
Create client
{{ end }}
</h2>
<form method="post" action="">
{{ if .Client.ClientID }}
Client ID: <code>{{ .Client.ClientID }}</code><br>
{{ end }}
Name: <input type="text" name="client_name" value="{{ .Client.ClientName }}"><br>
Website: <input type="url" name="client_uri" value="{{ .Client.ClientURI }}"><br>
<label>
Name
<input type="text" name="client_name" value="{{ .Client.ClientName }}">
</label>
<label>
Website
<input type="url" name="client_uri" value="{{ .Client.ClientURI }}">
</label>
Client type:
{{ if .Client.ID }}
{{ if .Client.IsPublic }}
public
{{ else }}
confidential
{{ end }}
<br>
<p>
Client type
<br>
<strong>
{{ if .Client.IsPublic }}
Public
{{ else }}
Confidential
{{ end }}
</strong>
</p>
{{ else }}
<br>
Client type
<label> <input type="radio" name="client_type" value="confidential" checked> Confidential </label>
<br>
<label> <input type="radio" name="client_type" value="public"> Public </label>
<br>
{{ end }}
Redirect URIs:<br>
<textarea name="redirect_uris">{{ .Client.RedirectURIs }}</textarea><br>
<small>The special URI <code>http://localhost</code> matches all loopback interfaces.</small><br>
<label>
Redirect URIs
<textarea name="redirect_uris" wrap="off">{{ .Client.RedirectURIs }}</textarea>
<small>The special URI <code>http://localhost</code> matches all loopback interfaces.</small><br>
</label>
<button type="submit">
{{ if .Client.ID }}
Update client
{{ else }}
Create client
{{ end }}
</button>
{{ if .Client.ID }}
{{ if not .Client.IsPublic }}
<button type="submit" name="rotate">Rotate client secret</button>
{{ end }}
<button type="submit" name="delete">Delete client</button>
{{ end }}
<a href="/"><button type="button">Cancel</button></a>
</form>
</main>
{{ template "foot.html" }}
{{ template "head.html" .Base }}
{{ template "nav.html" .Base }}
<main>
<h1>{{ .ServerName }}</h1>
<h2>
{{ if .User.ID }}
Update user
{{ else }}
Create user
{{ end }}
</h2>
<form method="post" action="">
Username: <input type="text" name="username" value="{{ .User.Username }}" required><br>
Password: <input type="password" name="password"><br>
<label>
Username
<input type="text" name="username" value="{{ .User.Username }}" required>
</label>
<label>
Password
<input type="password" name="password">
</label>
{{ if not (eq .Me.ID .User.ID) }}
<label>
<input type="checkbox" name="admin" {{ if .User.Admin }}checked{{ end }}>
Administrator
</label><br>
</label>
{{ end }}
<button type="submit">
{{ if .User.ID }}
Update user
{{ else }}
Create user
{{ end }}
</button>
<a href="/"><button type="button">Cancel</button></a>
</form>
</main>
{{ template "foot.html" }}
<nav>
<div id="nav-inner">
<h1><a href="/">{{ .ServerName }}</a></h1>
</div>
</nav>